Solved

How use query field in a report field

Posted on 2013-12-04
4
331 Views
Last Modified: 2013-12-04
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



?
0
Comment
Question by:SteveL13
  • 3
4 Comments
 
LVL 61

Expert Comment

by:mbizup
ID: 39695941
From your description, the query has only one record (?)

Me.Unboundfield1 = DLookup("fieldname", "qryname")
0
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 39695945
Or simply set the controlsource property of the textbox to

 = DLookup("fieldname", "qryname")
0
 

Author Comment

by:SteveL13
ID: 39696068
Both seem to work.  Since I have several fields on the report would one method perform better than the other?
0
 
LVL 61

Expert Comment

by:mbizup
ID: 39696085
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

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question