Hi folks,
I am trying to use a variable (defined in my function) in a SQL statement.
But its not working. I've bolded the line where my function fails to work, everything else is A-OK!
Function Upload(Filepath As String, CoName As Integer, InvType As Integer, InvDate As Date)
Dim dbs As Database
Set dbs = CurrentDb
If CoName = 1 And InvType = 2 Then
DoCmd.TransferText acImportDelim, , "Inv_Co1", Filepath, True
DoCmd.SetWarnings False
dbs.Execute "qryCo1apdMerge"
dbs.Execute "qryCo1updtNotApp"
DoCmd.RunSQL "UPDATE TestTable SET TestTable.CompanyID = FilePath AND TestTable.InvType = InvType AND TestTable.InvDate = InvDate WHERE TestTable.CompanyID is Null AND TestTable.InvType is Null AND TestTable.InvDate is Null"
DoCmd.RunSQL "DELETE * FROM Inv_Co1"
DoCmd.SetWarnings True
End If
End Function