Genengineer
Technical User
I tried to set up a form where the user could select Country and Event from combo boxes, and then pass the results to a DoCmd.Openreport.
I tried all sorts of combinations of formatting and kept getting data mismatches or the openreport would not recognize the input, so I gave up and just used the “input” function - that is get access to ask for input for variables it did not recognize as follows.
This works well, but it requires me to put a list of countries on the form so the user types the correct ones in, rather than using the combobox with a “select distinctrow” to show the valid values.
How do I get the combo box entries to transfer to the openreport function? Both Country and Event have text attributes.
Many thanks for any help I can get.
Ray Shillito
I tried all sorts of combinations of formatting and kept getting data mismatches or the openreport would not recognize the input, so I gave up and just used the “input” function - that is get access to ask for input for variables it did not recognize as follows.
This works well, but it requires me to put a list of countries on the form so the user types the correct ones in, rather than using the combobox with a “select distinctrow” to show the valid values.
How do I get the combo box entries to transfer to the openreport function? Both Country and Event have text attributes.
Code:
Private Sub Runquery_Click()
On Error GoTo Err_Runquery_Click
Dim WClause
Const Rview = "acViewPreview"
Const SView = "SelectRelations"
Const RName = "RegAgreeCountryEvent"
WClause = "[SelectRelations].[Country] = [Enter Country Here]" & _
" AND [SelectRelations].[Event] = [Enter Event Number Here] "
DoCmd.OpenReport _
Reportname:=RName, _
View:=acViewPreview, _
Filtername:=SView, _
WhereCondition:=WClause
' "[Type] = '" & [ProductType] & "'"
Exit_Runquery_Click:
Exit Sub
Err_Runquery_Click:
MsgBox Err.Description
Resume Exit_Runquery_Click
End Sub
Many thanks for any help I can get.
Ray Shillito