Solved

How use query field in a report field

Posted on 2013-12-04
4
355 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 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
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 “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

751 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