Simple Query Help

JamieW

Registered User.
Local time
Today, 08:13
Joined
Nov 2, 2006
Messages
17
I built an update query that adds two strings of text together with a _ inbetween.

eg

field1 = Hello
Field2 = Jamie

after update= Hello_Jamie

This works fine but when i attempt to run the code in SQL on an after update instance i can't get it to compile

The SQL straight from the working Update query is:

UPDATE tblPID SET tblPID.PIDPIDNoRev = (tblPID.PIDno)+"_"+(tblPID.PIDRev);

I have tried quite a few different ways and believe it to be a probelm with the speech marks or underscore

DoCmd.RunSQL "UPDATE [tblPID] SET [tblPID].PIDPIDNoRev = (([tblPID].PIDno)+"_"+([tblPID].PIDRev));"

anyone got any ideas? i'm sure it's pretty simple

Thanks, Jamie
 
Hi -

Suspect it's the plus signs. Try:

DoCmd.RunSQL "UPDATE [tblPID] SET [tblPID].PIDPIDNoRev = (([tblPID].PIDno) & "_" & ([tblPID].PIDRev));"

HTH - Bob
 
Cheers bob,

still raised an error but i changed it a little and it worked

It Didn't like how i did my speech marks either :(

DoCmd.RunSQL "UPDATE [tblPID] SET [tblPID].PIDPIDNoRev = (([tblPID].PIDno) & '_' & ([tblPID].PIDRev));"

worked

cheers Bob,

Jamie
 

Users who are viewing this thread

Back
Top Bottom