Reputation: 9
I'm very new to Access VBA and am trying to open an access report based on two input text boxes and a combo box input.
This form consists of 2 unbound Start date and End date text boxes based on the Claim Process Date column; and there is a combobox to select the Customer name.
I'm trying to create a button which opens the report based on these three criteria, but I get a mismatched data type error.
Private Sub Command51_Click()
Dim strCriteria As String
strCriteria = "[Claim Process Date] BETWEEN #" & Me.txtStartDate & "# AND #" & Me.txtEndDate & "#" And "[Customer Name] = '" & Me.Combo49 & "'"
DoCmd.OpenReport "CustomerClaims", acViewPreview, strCriteria
End Sub
Any suggestion would be appreciated. Thank You
Upvotes: 0
Views: 75
Reputation: 5068
And
was left out of the query/quotes, and there's a missing space.
strCriteria = "[Claim Process Date] BETWEEN #" & Me.txtStartDate & "# AND #" & _
Me.txtEndDate & "#" And "[Customer Name] = '" & Me.Combo49 & "'"
becomes (see 2nd line)
strCriteria = "[Claim Process Date] BETWEEN #" & Me.txtStartDate & "# AND #" & _
Me.txtEndDate & "# And [Customer Name] = '" & Me.Combo49 & "'"
Upvotes: 0