Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conrol Source Binding!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1

Status
Not open for further replies.

MattRK

Programmer
Feb 3, 2002
29
US
I guess i am just stupid or something, but i cnat figure out for the life of me how to bind a something to a specific table or query field. Like i have a report that i want to have several differnt querys included in it.

To bind a query called Temp Stop to this report, i thought i could simply just type in =[Query Name].[Temp Stop]. But no, it doesnt work that way for some reason.

Can someone please tell me how to go about doing this? I would really appriciate it.

-Mr.K
 
Hi Mr. K!

You need to either set the record source of the report to the query and then you should see the field in the drop down of the control source. If you want to access a field from a query that is not the record source you use:

DLookUp("YourField", "YourQuery", "YourLinkingField = '" & Me!YourLinkingField & "'"

This criteria assumes that the linking field between the queries is a text field, if it isn't you will not need the single quotes, or the last set of double quotes.

hth
Jeff Bridgham
bridgham@purdue.edu
 
I dont have a linking field. How would i create one of these?
 
Hi!

Well, all I mean by a linking field is some field in both queries that Access can use to find the correct record in the query for the record in the report. You will not need a linking field in two instance:

1.) The query in the DLookUp statement is an aggregate query.

2.) You know that the query will return only one record.

In each of these cases there will only be one record returned by the query so there is no need for criteria to select the record. So all the last argument of the DLookUp does is tell Access which record to select the field from.

BTW, in my first post I forgot the = before the DLookUp.

hth
Jeff Bridgham
bridgham@purdue.edu
 
Ok, mabey im asking the wrong question. Sorry. :) What i have are about 7 differnt querys that i want to include in a report. I just want it to look like this.

Query 1:
--------
data
data
data

Query 2:
--------
data
data
data

etc...

Nothing fancy, i just want that report to display all 7 (or whatever) querys. I hope this is possible. Thanks for any help anyone can provide.

-Mr.K
 
Hi!

Do the queries have the same fields? If they do, you can set up the report with the fields in question and run the report from a form changing the recordsource each time. Alternatively, you may be able to do a Union query and use that as your recordsource for the report. Include a field which tells you which query the data comes from and you can group on this field.

hth
Jeff Bridgham
bridgham@purdue.edu
 
Mr. K -

Would it make sense to have the report unbound (ie. with no recordsource set) and then bring in each of the seven queries as seven separate sub-reports?

It wouldn't matter if the data in each of the queries were related to each other or not, and it wouldn't matter if all seven of the queries had different fields.

Heather
 
Thanks for all the advice.

Heather, that is what i finaly did. I wasnt sure how subreports worked, but after playing with them for awhile i finaly ended up using them. I created my 7 differnt reports and then on "Master" unbound report and added each of the 7 reports as subreports. It wasnt to hard, actually.

Again, thanks for all the help!

-Mr.K
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top