SQL line and problem with string

swarv

Registered User.
Local time
Today, 15:00
Joined
Dec 2, 2008
Messages
196
Hi all,

I have the following code. a is a string defined in the procedure. I would like to place the value to a into the SQL text but it doeesn't seem to work

SQLText1 = "UPDATE tbl_users" & " SET tbl_users.new2008hols = a " & " WHERE tbl_users.user_id = '" & Me.Text18 & "'"

Do I need to place quotes or something round the a ?

Thanks

Martin
 
Change

SQLText1 = "UPDATE tbl_users" & " SET tbl_users.new2008hols = a " & " WHERE tbl_users.user_id = '" & Me.Text18 & "'"

To

SQLText1 = "UPDATE tbl_users SET new2008hols = 'a' WHERE user_id = '" & Me.Text18 & "'"

If user_id is a numeric field then it should be

SQLText1 = "UPDATE tbl_users SET new2008hols = 'a' WHERE user_id = " & Me.Text18

If 'a' is a variable then

SQLText1 = "UPDATE tbl_users SET new2008hols = '" & strVar & "' WHERE user_id = " & Me.Text18
 
Last edited:
excellent - thank you so much
 

Users who are viewing this thread

Back
Top Bottom