Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading value of a table field, not present in a report field

Status
Not open for further replies.

Bresart

Programmer
Feb 14, 2007
314
ES
Hi, is it possible to read the value of a field belowing to the table included in the query in which the report is based, but without adding to the report a textbox which controlsource is that field?

It would be something similar to Me.fieldname or Me.[fieldname], that works in forms.

Thanks in advance for any help.

 
Depending on thge version of Access, [field_name] used to work. Another (higher overhead) way would be to set a variable using DLookup:
strVar = DLookup("[field_name]","table_name")

I wondered why the baseball was getting bigger.
Then it hit me.
 
Thanks.

genomon, "Another (higher overhead) way" through DLookup would be also less optimized and fast than Me.[fieldname] and even than a hiden textbox?
 
If you are only using 1 or 2 lookups you shouldn't notice a hit in performance. Bad idea to use lots of 'em tho....

I wondered why the baseball was getting bigger.
Then it hit me.
 
After considering Remou's advice, that would be better if you are using this data on each detail line; in fact if you use a hidden text box you can refer to its .value property in code with just the contol name (txtTextBoxName). Way cleaner & easier to maintain.

I wondered why the baseball was getting bigger.
Then it hit me.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top