Hi,
i need help with the following vba code. I have no knowledge on VBA.
Private Sub Command49_Click()
On Error GoTo Err_Handler
Const REPORTNAME = "Cheque Book Detail"
Const MESSAGETEXT = "Both a Cheque Paid To and Account Catagory must be selected."
Dim strCriteria As String
' build string expression to filter report
' to selected Cheque Paid To and Account Catagory
strCriteria = "[ChqIssuedWorker] = """ & Me.issu2 & """"
" And [ChqTypePmt] = """ & Me.AccountCatagory & """"
' make sure a Cheque Paid To is selected
If Not IsNull(Me.issu2) And Not IsNull(Me.AccountCatagory) Then
' open report filtered to selected Cheque Paid To
DoCmd.OpenReport REPORTNAME, _
View:=acViewPreview, _
WhereCondition:=strCriteria
Else
MsgBox MESSAGETEXT, vbExclamation, "Invalid operation"
End If
Exit_Here:
Exit Sub
Err_Handler:
MsgBox Err.Description, vbExclamation, "Error"
Resume Exit_Here
End Sub
The problem is in the following line
" And [ChqTypePmt] = """ & Me.AccountCatagory & """"
and I have no clue how to fix this.