Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How use query field in a report field

Posted on 2013-12-04
4
Medium Priority
?
359 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
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 …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

705 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