
Cetting A Report To Select Records Based Upon A Value Selected In A Combo Box
I cannot get the below
VBA code in
ACCESS97 To Run.
' Purpose To Select An Item From A Combo
Drop Down Box and Then Get A Report To
Run Showing Only Those Records Which
Match The Criteria From The Combo Box.
Have tried many different varieties of
the below and cannot get it to work.
Private Sub Squizz_Click()
Dim CountryEntry As Variant
Dim MyChar As Variant
Dim MyChar2 As Variant
Dim CountrySelect As String
Dim CountryString As String
Dim CountryStringEnd As String
' MyChar = Chr(34)- Not Being Used Here
At This Stage
MyChar2 = Chr(39)
Let CountrySelect = [CountryName] '
"Country" Here Is A Combo Control On A
Form
Let CountryString = "Country = '"
Let CountryStringEnd = MyChar2
CountryEntry = CountryString &
CountrySelect & CountryStringEnd ' This
Won't Work _
' While The Below Line Works Fine
'CountryEntry = "Country = 'MEXICO' OR
Country = 'UK'" This Works Fine
'CountryEntry = "Country = 'UK'" This
Works Fine
DoCmd.OpenReport "RptCustomers",
acViewPreview, , CountryEntry
End Sub