update query with multiple creteria

ootkhopdi

Registered User.
Local time
Tomorrow, 04:40
Joined
Oct 17, 2013
Messages
181
hi

pls give me solution how can i update fields of one table with update query
where creteria are more than one 1

example

DoCmd.RunSQL "UPDATE Salary2009toUpdate SET " & Me.Combo2 & "='" & Me.Text4 & "' Where Empid='" & Me.Combo0 & "'" and where bank='" & Bankname & "'"
what is the syntex error
pls help me
 
Remove the second Where
Code:
DoCmd.RunSQL "UPDATE Salary2009toUpdate SET " & Me.Combo2 & "='" & Me.Text4 & "' Where Empid='" & Me.Combo0 & "'" and [COLOR="Red"]where [/COLOR]bank='" & Bankname & "'"

As a hint if you create the query you want in the Query Designer then switch to SQL view it will give the correct syntax, you just need to create the string correctly.
 
Last edited:
i remove where but not working

pls give me solution
 
What is your exact SQL code and please indicate which criteria are numbers or text or dates.
 
Hi minty
thanks for give attention to my prob..

my code is
DoCmd.RunSQL "UPDATE Salary2009toUpdate SET " & Me.Combo2 & "='" & Me.Text4 & "' Where Empid='" & Me.Combo0 & "'" and where bank='" & Bankname & "'"

in this code ,, all variebles ( EMPID,Text4 and Bankname are Text Format.

in some case Text 4 canbe date ,,,

Pls give me solotion

thanks in advance
 
Me.Combo2 should be a Field NAME not a variable?
And if text4 can be a date you would have to enclose it # # and make sure it is in mm/dd/yyyy format to work reliably!
 

Users who are viewing this thread

Back
Top Bottom