I am getting the following error when I execute this code: "Data type mismatch in criteria expression." Thanks in advance.
Code:Dim WhereUsed As Boolean = False Dim WhereString If Len(Me.cboCaller.Text) > 0 Then WhereString = "WHERE CALLER=?" WhereUsed = True Else End If Dim SQL As String SQL = "SELECT tblFirms.ORG_PK, tblFirms.ORG_NAME, tblStatus_Type.Status_TX, tblFirms.AA_NM, tblFirms.CONTACT_NM, tblFirms.CONTACT_PH, tblFirms.AA_PH, tblFirms.ASSESSED_AMOUNT, tblFirms.REN_BAL, tblFirms.DAILY_BAL, tblCallStatus.Call_Status, tblCallResults.Call_Result, tblCallDetails.caller, tblCallDetails.call_date " & _ "FROM (((tblFirms INNER JOIN tblCallDetails ON tblFirms.ORG_PK = tblCallDetails.ORG_PK) INNER JOIN tblStatus_Type ON tblFirms.STATUS_ID = tblStatus_Type.Status_ID) INNER JOIN tblCallStatus ON tblCallDetails.CSTAT_ID = tblCallStatus.CStat_ID) INNER JOIN tblCallResults ON tblCallDetails.CRESULT_ID = tblCallResults.CResult_ID " Dim StartDt As Date = Now 'start date is 7 days ago StartDt = StartDt.AddDays(-7) If WhereUsed = True Then SQL = SQL & WhereString & " and call_date>? " Else SQL = SQL & "where call_date>? " End If SQL = SQL & "ORDER BY tblCallDetails.call_date DESC " Dim myList As New List(Of String) Dim TryAttempt As Integer = 0 Retry: 'Try Using conLocal As New OleDb.OleDbConnection(myConnString) Using commandLocal As New OleDb.OleDbCommand(SQL, conLocal) If WhereUsed = True Then commandLocal.Parameters.AddWithValue("FirstName", Me.cboCaller.Text) commandLocal.Parameters.AddWithValue("FirstName", StartDt) Else commandLocal.Parameters.AddWithValue("FirstName", StartDt) End If conLocal.Open() Using dataReader As OleDb.OleDbDataReader = commandLocal.ExecuteReader While dataReader.Read


LinkBack URL
About LinkBacks




Reply With Quote





Bookmarks