Hi, this is the first time I have posted a question. I'm really hoping for somebody to help me. I have a text box in a report that I need to populate via a function. The data required (OPENING BALANCE) is already in another query titled: "qryEOD Report Query".

I am using a query (qryEOD Report) to populate the report and I cannot seem to make this text box work - always an error.

This is the function used in the expression builder:

=DLookUp("[qryEOD Report Query].[OPENING BALANCE]","qryEOD Report Query","[qryEOD Report Query].[CP NAME]"="[qryEOD Report].[CP Name]")

Appreciate anyone's help.

Cheers,
JFunk

It's hard to tell without knowing what the structure of your database is, but the problem appears to be with the last argument of the expression.

Try something along these lines:

=DLookUp("[qryEOD Report Query].[OPENING BALANCE]","qryEOD Report Query","[qryEOD Report Query].[CP NAME]=" & [qryEOD Report].[CP Name])

Also, you can try using exclamation marks instead of periods:

=DLookUp("[qryEOD Report Query]![OPENING BALANCE]","qryEOD Report Query","[qryEOD Report Query]![CP NAME]=" & [qryEOD Report]![CP Name])

Hi Timothy,
Sorry for the late reply but I did try your suggestions and it still didn't work. I am not sure why. In the end I just created another query which performed the calculations and then used that same query to create my report.

Appreciate your help though.

Cheers,
JFunk

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.