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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form that allows me to select from multiple reports 1

Status
Not open for further replies.

allstarfrank

Technical User
Sep 9, 2003
3
US
I have created a form with several different combo boxes that allow the user to define(change the criteria) which information that they want on a report in a format that has a "FROM" and "THRU" column. The row source for each combo box is coming from various tables. For example, the user must define a single or range of company names, invoice dates, invoice number,etc. After selecting this information, the user must select which report that they want to print. My questions are: 1) How can I insert a combo box that will list the available reports that I have created? The user would select the report that they want to preview and then, hit the print button to see the report. The report that the user selects would print based on the information typed into the other combo boxes. 2)If the user wants to print all of the information and does not want to define each combo box, how would I have Access automatically insert default information for each combo box?
 
1) I create a table of reports. This table contains the actual report object name as well as a friendly title, description, status,... You can create a list box based on this table.

2) I build a where clause which is used in the docmd.openreport code:
Dim strWhere as String
strWhere = "1=1 "
If not IsNull(me.txtStartDate) then
strWhere = strWhere & " AND [DateField] >=#" & _
Me.txtStartDate & "# "
End If
If not IsNull(me.txtEndDate) then
strWhere = strWhere & " AND [DateField] <=#" & _
Me.txtEndDate & "# "
End If
'more similar lines of code
DoCmd.OpenReport Me.lboReport, acViewPreview, , strWhere


Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top