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!

Filter report based on a query using combo box

Status
Not open for further replies.

Rufusjeep

Technical User
Nov 6, 2001
10
US
Have a form on it with a combop box on it where the user can select the training topic that they would like a see all of the details on. After they select the topic and hit the generate report button, the report opens empty.

Here is the code that I am using to filter the report results:

DoCmd.OpenReport "rptTRAININGINFO", acViewPreview
Reports!rptTRAININGINFO.Filter = "[Topic] = Forms!frmTrainingInfo![Combo4]
Reports!rptTRAININGINFO.FilterOn = True

Any ideas on what I need to chage to get it to work.

Thanks,
Mike
 
Try something like this:

Dim sWhere as String

sWhere = "[Topic] = " + Cstr(Forms!frmTrainingInfo![Combo4])
or, if Topic is a string:
sWhere = "[Topic] = '" + Forms!frmTrainingInfo![Combo4] + "'"
DoCmd.OpenReport "rptTRAININGINFO", acViewPreview,,sWhere

You don't need to worry about FilterOn property this way. Good Luck,
Mike T
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top