Re: Syntax problem

alicejwz

Registered User.
Local time
Today, 16:31
Joined
Jul 9, 2003
Messages
91
Re: Syntax problem

Hi all,

I have a query updates the table in code it will only works if I have one criteria.
str = "UPDATE EquipMaintenance Set NextSchedMaint = #" & next_dt & "# Where [MaintTasksID] = " & rst![MaintTasksID] & ""
or
str = "UPDATE EquipMaintenance Set NextSchedMaint = #" & next_dt & "# Where [EquipmentID] = " & rst![EquipmentID] & " " "

this is error message if I have two criteria
data type mismatch in criteria expression

this code I'm trying to get it work
str = "UPDATE EquipMaintenance Set NextSchedMaint = #" & next_dt & "# Where [EquipmentID] = " & rst![EquipmentID] & " and [MaintTasksID] = " & rst![MaintTasksID] & ""
Debug.Print str
DoCmd.RunSQL str

data type for the following variables
next_dt - date
EquipmentID - text
MaintTasksID - number

I'm using AC2K

Thanks very much!
 
Hi,

Try:

str = "UPDATE EquipMaintenance Set NextSchedMaint = #" & next_dt & "# " & _
"Where [EquipmentID] = '" & rst![EquipmentID] & "' " & _
"AND[MaintTasksID] = " & rst![MaintTasksID]

I just broke it into three lines for readability.
 
Re: Syntax problem

Thanks, RuralGuy!
That works
 
You're very welcome and thanks for posting back with your success.
 

Users who are viewing this thread

Back
Top Bottom