Solved

How use query field in a report field

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
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.

706 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now