J
John O. Graybill
Greetings All:
Can anyone suggest why this function fails with runtime Error 3464
"Data type mismatch in criteria expression"? The value of
varTaskKeyID is always an AutoNumber Long Integer from another table.
Am I not seeing something in the syntax of the WHERE clause? Any help
would be most appreciated. Thanks,
John
Function fcnRunAppender(varTaskKeyID As Variant)
On Error GoTo Err_fcnRunAppender
Dim strINSERT As String
Dim strSELECT As String
Dim strFROM As String
Dim strWHERE As String
Dim strSQL As String
Dim DB As Database
If IsNull(varTaskKeyID) = True Then
GoTo Exit_fcnRunAppender
End If
Set DB = CurrentDb
strINSERT = "INSERT INTO [tblOldStrengthTaskRecords]"
strSELECT = "SELECT tblStrengthTasks.*"
strFROM = "FROM [tblStrengthTasks]"
strWHERE = "WHERE (((tblStrengthTasks.StrengthTaskKeyID)= " &
varTaskKeyID & "));"
strSQL = strINSERT & strSELECT & strFROM & strWHERE
DB.Execute strSQL, dbFailOnError
Exit_fcnRunAppender:
Exit Function
Err_fcnRunAppender:
Call ErrorLogger(Me.Name, "fcnRunAppender_Function",
Err.Description, Err.Number)
Resume Exit_fcnRunAppender
End Function
Can anyone suggest why this function fails with runtime Error 3464
"Data type mismatch in criteria expression"? The value of
varTaskKeyID is always an AutoNumber Long Integer from another table.
Am I not seeing something in the syntax of the WHERE clause? Any help
would be most appreciated. Thanks,
John
Function fcnRunAppender(varTaskKeyID As Variant)
On Error GoTo Err_fcnRunAppender
Dim strINSERT As String
Dim strSELECT As String
Dim strFROM As String
Dim strWHERE As String
Dim strSQL As String
Dim DB As Database
If IsNull(varTaskKeyID) = True Then
GoTo Exit_fcnRunAppender
End If
Set DB = CurrentDb
strINSERT = "INSERT INTO [tblOldStrengthTaskRecords]"
strSELECT = "SELECT tblStrengthTasks.*"
strFROM = "FROM [tblStrengthTasks]"
strWHERE = "WHERE (((tblStrengthTasks.StrengthTaskKeyID)= " &
varTaskKeyID & "));"
strSQL = strINSERT & strSELECT & strFROM & strWHERE
DB.Execute strSQL, dbFailOnError
Exit_fcnRunAppender:
Exit Function
Err_fcnRunAppender:
Call ErrorLogger(Me.Name, "fcnRunAppender_Function",
Err.Description, Err.Number)
Resume Exit_fcnRunAppender
End Function