Peanut2232425
IS-IT--Management
It is telling me that I have a Mismatch Type error. Here is my code. I can't tell anywhere where there is one. Can some one please help!!!
Private Sub Report_Open(Cancel As Integer)
On Error GoTo Report_Open_Err
Dim myDB As Database
Dim repRS As Recordset
Dim SqlCPC As String
Dim IWhere As Integer
Dim DetailTitle As String
SqlCPC = "Select * from CPC "
If Not IsNull(Forms!frmCPCReport.SettlementOfficer) Then
If IWhere Then
DetailTitle = DetailTitle & ", " & Forms!frmCPCReport.SettlementOfficer
SqlCPC = SqlCPC & " and SettlementOfficer like "" & Forms!frmCPCReport.SettlementOfficer & " * """"
Else
DetailTitle = DetailTitle & " For " & Forms!frmCPCReport.SettlementOfficer
SqlCPC = SqlCPC & " where SettlementOfficer like """ & Forms!frmCPCReport.SettlementOfficer & "*"""
IWhere = True
End If
End If
SqlCPC = SqlCPC & ";"
Set myDB = CurrentDb
Set repRS = myDB.OpenRecordset(SqlCPC)
If Not repRS.EOF And Not repRS.BOF Then
Me.RecordSource = SqlCPC
Else
MsgBox "No records to print"
Cancel = True
End If
'If Not Cancel Then DoCmd.Close acForm, "frmCPCReport"
Me!DetailHeader.Caption = Me!DetailHeader.Caption & DetailTitle
Report_Open_Exit:
Exit Sub
Report_Open_Err:
MsgBox Err.Description
Resume Report_Open_Exit
End Sub
Private Sub Report_Open(Cancel As Integer)
On Error GoTo Report_Open_Err
Dim myDB As Database
Dim repRS As Recordset
Dim SqlCPC As String
Dim IWhere As Integer
Dim DetailTitle As String
SqlCPC = "Select * from CPC "
If Not IsNull(Forms!frmCPCReport.SettlementOfficer) Then
If IWhere Then
DetailTitle = DetailTitle & ", " & Forms!frmCPCReport.SettlementOfficer
SqlCPC = SqlCPC & " and SettlementOfficer like "" & Forms!frmCPCReport.SettlementOfficer & " * """"
Else
DetailTitle = DetailTitle & " For " & Forms!frmCPCReport.SettlementOfficer
SqlCPC = SqlCPC & " where SettlementOfficer like """ & Forms!frmCPCReport.SettlementOfficer & "*"""
IWhere = True
End If
End If
SqlCPC = SqlCPC & ";"
Set myDB = CurrentDb
Set repRS = myDB.OpenRecordset(SqlCPC)
If Not repRS.EOF And Not repRS.BOF Then
Me.RecordSource = SqlCPC
Else
MsgBox "No records to print"
Cancel = True
End If
'If Not Cancel Then DoCmd.Close acForm, "frmCPCReport"
Me!DetailHeader.Caption = Me!DetailHeader.Caption & DetailTitle
Report_Open_Exit:
Exit Sub
Report_Open_Err:
MsgBox Err.Description
Resume Report_Open_Exit
End Sub