Using Query as a Textbox Record Source

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi everyone,

I am positive that I seen Marsh or someone post an answer for this but I
cannot get the right search criteria right or something.

My problem is that I have a subform with a textbox in the footer that
displays a calculated value that I have working perfectly in the query that
it resides.

When I try using:

DLookup("TotalValue", "qryRunningTotal")

I get the ever annoying "#Name?" error. If I run the query by itself; no
problem. Once I put the DLookup in the textbox (even in a textbox that is on
a blank form all by itself), I get the error.

I know I am missing something minor, but if anyone could point me in the
right direction, I would greatly appreciate it.

Thanks!

Lance
 
Hi everyone,

I am positive that I seen Marsh or someone post an answer for this but I
cannot get the right search criteria right or something.

My problem is that I have a subform with a textbox in the footer that
displays a calculated value that I have working perfectly in the query that
it resides.

When I try using:

DLookup("TotalValue", "qryRunningTotal")

I get the ever annoying "#Name?" error. If I run the query by itself; no
problem. Once I put the DLookup in the textbox (even in a textbox that is on
a blank form all by itself), I get the error.

I know I am missing something minor, but if anyone could point me in the
right direction, I would greatly appreciate it.

Thanks!

Lance


1) You did place an = sign before the expression didn't you?
=DLookUp(etc.)

2 Are the field and query names spelled correctly?
"TotalValue" is not the same as "Total Value".

3) Try placing brackets around the names:
= DLookup("[TotalValue]", "[qryRunningTotal]")

4) Also, make sure the name of that control is not 'TotalValue'.
 
Thanks for the reply Fred.

I am not exactly sure why but once I placed the square brackets around the
first argument, it worked. I usually do this as good practice and in this
case there was not a space either.

As long as it works consistently.

Thanks again,

Lance



fredg said:
Hi everyone,

I am positive that I seen Marsh or someone post an answer for this but I
cannot get the right search criteria right or something.

My problem is that I have a subform with a textbox in the footer that
displays a calculated value that I have working perfectly in the query that
it resides.

When I try using:

DLookup("TotalValue", "qryRunningTotal")

I get the ever annoying "#Name?" error. If I run the query by itself; no
problem. Once I put the DLookup in the textbox (even in a textbox that is on
a blank form all by itself), I get the error.

I know I am missing something minor, but if anyone could point me in the
right direction, I would greatly appreciate it.

Thanks!

Lance


1) You did place an = sign before the expression didn't you?
=DLookUp(etc.)

2 Are the field and query names spelled correctly?
"TotalValue" is not the same as "Total Value".

3) Try placing brackets around the names:
= DLookup("[TotalValue]", "[qryRunningTotal]")

4) Also, make sure the name of that control is not 'TotalValue'.
 
Back
Top