query problems with certain characters

A

Adrian

I have a problem whereby I'm trying to move data from one field to another. This problem also pertains to data being added to a table.

Whenever there is a character such as " or | or ' that I am trying to put into the field, this causes problems. Everything else works fin

The method I have been using is the

Docmd.execute "UPDATE TABLE SET " ETC ET

There is also a problem when I us

rs.addne
rs!field="text including strange char such as |||
rs.updat

How do I get around this - do I have to rely on parameter queries

Thank

Adrian
 
W

Wayne Morgan

The problem is that these characters are also delimiters. For example, when
you start the string with " and Access sees the next " it thinks the end of
the string has been reached. To place a " in a string, you have to double it
("") so that Access knows that you are referring to the character instead of
it being a delimiter. Another options is to concatenate the character in
using the Chr() function.

Example:
"this is a " & Chr(34) & " test"
will result in the string
this is a " test

If you need help, post the string you are working with. For more
information, here are some KB articles.
http://support.microsoft.com/default.aspx?scid=kb;en-us;178070
http://support.microsoft.com/default.aspx?scid=kb;en-us;147687
http://support.microsoft.com/default.aspx?scid=kb;en-us;181832

--
Wayne Morgan
Microsoft Access MVP


Adrian said:
I have a problem whereby I'm trying to move data from one field to
another. This problem also pertains to data being added to a table.
Whenever there is a character such as " or | or ' that I am trying to put
into the field, this causes problems. Everything else works fine
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top