|
-
Jun 30th, 2005, 12:36 PM
#1
Thread Starter
Frenzied Member
How to generate report based on combo box selection
Hi guys . I created a form that has 3 combo boxes. Their name are Project
Number, year and weekno . It has also a button that on click action supposed
to generate a report baced on my combo box criteria and then loads that report
for me. could any expert show me an example on how to do this. I have difficulty
finding an example in google since i did not exactly what is called this method
of generating report in access 2000.Thanks
-
Jun 30th, 2005, 12:57 PM
#2
Frenzied Member
Re: How to generate report based on combo box selection
One way:
Create a query to get what you want based on those values, e.g.,
VB Code:
SELECT * FROM tblFoo WHERE fldProj = Forms!frmFoo![Project Number] AND fldNum = Forms!frmFoo![year] AND fldWkNum = Forms!frmFoo![weekno]
and set the report's RecordSource to the query.
You could also do queryDef's & parameters in code.
Tengo mas preguntas que contestas
-
Jun 30th, 2005, 01:07 PM
#3
Thread Starter
Frenzied Member
Re: How to generate report based on combo box selection
 Originally Posted by salvelinus
One way:
Create a query to get what you want based on those values, e.g.,
VB Code:
SELECT * FROM tblFoo WHERE fldProj = Forms!frmFoo![Project Number] AND fldNum = Forms!frmFoo![year] AND fldWkNum = Forms!frmFoo![weekno]
and set the report's RecordSource to the query.
You could also do queryDef's & parameters in code.
Thank u for u reply. Is this for access 2000 ? where should i place your code?
could u explain allitle more on what to put on click event of the button on the form.Thanks
http://i5.photobucket.com/albums/y18...rojectdata.jpg ( report )
http://i5.photobucket.com/albums/y18...etionship4.jpg ( db tables)
-
Jul 1st, 2005, 06:52 AM
#4
Frenzied Member
Re: How to generate report based on combo box selection
Yes, Access 2000, and probably any version of Access (97 on, anyway).
Easiest way -
Create & save the query. It won't run by itself, but that's ok. Create the report and set the report's RecordSource property to the query.
In the form, in the Click event of a button put DoCmd.OpenReport "rptFoo" (or whatever your report's name is).
If you want a report in Word or Excel format (looking at your upload), that's a different story. But the above will work for an Access report.
Tengo mas preguntas que contestas
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|