Hi.. I tried to make two combo boxes with one command button that will run a query and then show the results that i chose in the combo boxes on a report... but when i klick the command button a dialog shows that says "enter value parameter"... i dont know what ive done wrong cause im very new at this.. therefore i would be glad for all the help i can get... the code is;
Private Sub runquery_Click()
On Error GoTo Err_runquery_Click
' set up constants and variables
Dim WClause As String
Const Rview = "acViewPreview"
Const SView = "SelectRelations" ' this is a query
' I am using a query to combine results
' from two linked tables
Const RName = "Reportname"
' this is a report
' get the parameters from the combo boxes
WClause = "[SelectRelations].[Country] = '" & Me.CountryCombo & _
"' AND [SelectRelations].[Event] = '" & Me.EventCombo & "'"
' Open the report in preview mode
DoCmd.OpenReport _
Reportname:=RName, _
View:=acViewPreview, _
Filtername:=SView, _
WhereCondition:=WClause
Exit_runquery_Click:
Exit Sub
Err_runquery_Click:
MsgBox Err.Description
Resume Exit_runquery_Click
End Sub
the sql code in the combo boxes are
SELECT DISTINCTROW [tblCountry].[CountryID], [tblCountry].[Country] FROM tblCountry ORDER BY [Country];
and the same with the city...
what can be wrong?
Private Sub runquery_Click()
On Error GoTo Err_runquery_Click
' set up constants and variables
Dim WClause As String
Const Rview = "acViewPreview"
Const SView = "SelectRelations" ' this is a query
' I am using a query to combine results
' from two linked tables
Const RName = "Reportname"
' this is a report
' get the parameters from the combo boxes
WClause = "[SelectRelations].[Country] = '" & Me.CountryCombo & _
"' AND [SelectRelations].[Event] = '" & Me.EventCombo & "'"
' Open the report in preview mode
DoCmd.OpenReport _
Reportname:=RName, _
View:=acViewPreview, _
Filtername:=SView, _
WhereCondition:=WClause
Exit_runquery_Click:
Exit Sub
Err_runquery_Click:
MsgBox Err.Description
Resume Exit_runquery_Click
End Sub
the sql code in the combo boxes are
SELECT DISTINCTROW [tblCountry].[CountryID], [tblCountry].[Country] FROM tblCountry ORDER BY [Country];
and the same with the city...
what can be wrong?