Re: Replacing quote character in string (2003)

I have included a screenshot: When I continue to Debug, the highlighted line is the Replace Line.
When hovering over vQ2, it shows the correct value: " ' " (without the spaces)

<IMG SRC=http://i34.photobucket.com/albums/d130/ForBob/SingleQuoteError.jpg>
This is triggered on BeforeUpdate when I have added a single quote character at the end of the line for test purposes.
Trigger is good, InStr() is good, Replace looks good, but RunTime Error comes up anyway.
There is no validation in the table.

Re: Replacing quote character in string (2003)

That fixed it. Hans Thanks for pointing out the obvious. Timing is everything.

A really basic error at this end. Sorry for wasting your time.

I have been away from Access for a while and have been being pulled in more frequently in the past few months.
I seem to recall that there is a variable that holds the pending value to be saved, how would I have referenced that?

Re: Replacing quote character in string (2003)

When the Before Update and After Update events occur, the Value property of the control contains the value about to be saved. The OldValue property contains the stored value (the one about to be replaced).

While the user is typing in the control, the Value and OldValue properties of the control both contain the stored value, and the Text property contains the currently displayed text. This can be used in the On Change event, and also in the On Key Down, On Key Press and On Key Up events. The Text property is only valid if the control has the focus, if you try to refer to the Text property of a control that doesn't have the focus, you'll get an error message.

Replacing quote char in string - SOLVED (2003)

I need to replace "single quote" characters Chr(39) in a text field. When this works I will duplicate it for "double quote" characters(34) also.
I have been unable to make this work.
I am able to locate the character, because the Instr() function is working. But I cannot work out the syntax for the Replace() function.

I have been using variable vQ2 in Replace() as the search string for single quote { ' }:
Here are some lines that did not work, no particular order, There are many others that I had tried before commenting them out for history.