Referencing on blank form #Name? error

10kz

Registered User.
Local time
Today, 00:05
Joined
Jan 9, 2017
Messages
21
If I have a blank form, and I want to reference a query in a text field, e.g.

query name: qry_TotalValue
field: TotalValue (numeric)


I want that field to be displayed in my blank form. I've tried by click on the control source and selecting the field from the query.

=[qry_TotalValue]![TotalValue]

This produces a "#Name?" value instead of the numeric value.
 
Have you set the format on the field in designer view.
I often find that even though the field is set to numeric, I still have to set the format to something. IE General Number or Fixed or Scientific etc.
 
Yep, I've tried general number, fixed, currency etc. Still giving me the #Name?
 
Try

Code:
=Dlookup("[TotalValue]","[qry_TotalValue]")
 
FYI, the use of DLookup() is the easiest way, using VBA, to reference a Field that is not part of the RecordSource for the Form; not just in this situation. More simply put, you cannot directly reference a Field by following its Domain Name (domain being a Table or Query) wit the Field Name, i.e.

[QueryName]![FieldName]

or

[TableName]![FieldName]
.

Referencing, like this, is done when using a SQL Statement is appropriate.

Linq ;0)>
 

Users who are viewing this thread

Back
Top Bottom