How use query field in a report field

I have a report with several unbound fields.  For each field I want to use a certain field from a query.  Each field's result comes from a separate query.

So then in the VBA code, for each field, would I have something like this in the onprint event?

Me.Unboundfield1 = Queries!qryname.fieldname

I've tried this but get an error:  Object required



?
SteveL13Asked:
Who is Participating?
 
mbizupConnect With a Mentor Commented:
Or simply set the controlsource property of the textbox to

 = DLookup("fieldname", "qryname")
0
 
mbizupCommented:
From your description, the query has only one record (?)

Me.Unboundfield1 = DLookup("fieldname", "qryname")
0
 
SteveL13Author Commented:
Both seem to work.  Since I have several fields on the report would one method perform better than the other?
0
 
mbizupCommented:
I generally prefer the control source method over code in reports (but that is just personal preference - I don't think the performance would be different for either.
0
All Courses

From novice to tech pro — start learning today.