Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

The vertical bar character in Acces SQL 1

Status
Not open for further replies.

vladk

Programmer
May 1, 2001
991
US
Hi,

I am working with Access from VB6. Some bright head set up the field, which values contain doubled "pipe" characters. I need to locate the record based on this field and update this field. I do it from VB front-end.

The example of the valies is:
A||04||WBG||111111||38610||3

I need to replace the last character "3" with character "1". The field name is "key".

The direct approach does not work, causing error 3075

Invalid use of vertical bars in query expression 'A||04||WBG||111111||38610||1'.

I tried approach from here but it did not work for me:


The initial (failed) query looks like this:

strSQL = "UPDATE Inputs SET Key =" & pstrNewKey & "," & _
" AI_quote_issue = " & ISSUE & "," & " AI_polversion = 1," & _
" DateTimeStamp = " & pstrDateTimeStamp & _
"WHERE key like " & pstrSelectedKey & _
"AND AI_quote_issue <> " & ISSUE & ";"

If anybody can help me make it work, it will be great!!!!

vladk
 
strSQL = "UPDATE Inputs SET Key =[!]'[/!]" & pstrNewKey & "[!]'[/!]," & _

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PHV,

Thank you very much. As always, your answer shots right in the center. I actually ended up with this string, which appears to work for me:

strSQL = "UPDATE Inputs SET Key =" & """" & pstrNewKey & """" & "," & _
" AI_quote_issue = " & """" & ISSUE & """" & "," & " AI_polversion = 1," & _
" DateTimeStamp = " & """" & pstrDateTimeStamp & """" & _
" WHERE key = " & """" & pstrSelectedKey & """" & _
" AND AI_quote_issue <> " & """" & ISSUE & """" & ";"

Thank you!

vladk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top