forms to reports (1 Viewer)

otis1969

Registered User.
Local time
Today, 09:09
Joined
Mar 13, 2003
Messages
42
I have a form that has 2 combo boxes on it, one is named Waters and the other is named Year.

I have also created a report from a query that shows fishermen, their licences and their company names. The query is a select query that asks for the Waters and the Year. My question is...how do I get the Waters and Year into that query from the form that I have created?
 

Treason

#@$%#!
Local time
Today, 05:09
Joined
Mar 12, 2002
Messages
340
If u want to make you form equal to your query.. Copt the record source from the report and paste it into the record source of the form. Then u can add those fields to the form
 

otis1969

Registered User.
Local time
Today, 09:09
Joined
Mar 13, 2003
Messages
42
A good idea! but still will not work. The combo boxes are used as a filter to create the reports. For example a user chooses the waterbody, this combo box is filled with a waterbody table. Then a fisherman table is accessed to get the information about that waterbody.

I would also like to know, how do i get the combo box text into a variable in vba.
 

KevinM

Registered User.
Local time
Today, 09:09
Joined
Jun 15, 2000
Messages
719
Use a command button on your form to open the report using a WHERE condition, referencing the two values...

DoCmd.OpenReport "ReportName", acViewNormal, ,"[Waters] = " & me![Waters] & " AND [Year] = " Me![Year]

Base the report on a normal select query, including the required fields with no parameters.
 
Last edited:

otis1969

Registered User.
Local time
Today, 09:09
Joined
Mar 13, 2003
Messages
42
Thanks Kevin that helped, I also had to take the PK out of the Year table, didnt matter much since I only used the table for this one form..and hopefully others !!!
 

Users who are viewing this thread

Top Bottom