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!

Filtering a Report based off forms combo box

Status
Not open for further replies.

spartansFC

Programmer
Apr 1, 2009
165
GB
Hi

I know how to filter reports via form combos but for some reason, a little glitch is happening, when i click the command button a pop up window appears asking to enter the paramater value, for example if i've selected May-13 for the combo box, the parameter pop up window will ask for "May", if i put in any number, the report will then run with the filter applied, so i'm not sure what's going on.

the combo box has:

Code:
SELECT tblAvailabilityMonths.strAvailabilityMnthDesc, tblAvailabilityMonths.lngAvailabilityMnthID FROM tblAvailabilityMonths GROUP BY tblAvailabilityMonths.strAvailabilityMnthDesc, tblAvailabilityMonths.lngAvailabilityMnthID ORDER BY tblAvailabilityMonths.lngAvailabilityMnthID;

the command button to print the report has:

Code:
Private Sub Command38_Click()
 If IsNull([cmbMonthYear]) Then

        MsgBox "Apply a filter to the form first."

 Else
        DoCmd.OpenReport "Registers: Elswick", acViewPreview, , Me.cmbMonthYear
    End If
End Sub

the query has: expr2: Format([TheDate],"mmm-yy"), then the criteria is [Forms]![frmAvailability1AElswickMain]![cmbMonthYear]

the report does work, i just need to get rid of this annoying pop up window

Mikie
 
I would use the WHERE CONDITION of the DoCmd.OpenReport method.

What is the field in the report's record source that you want to use for filtering?
What is the data type of the field?

What column is bound in your combo box?
What are the values of the bound column of your combo box?

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top