runtime error 3077

G

Guest

Hi,
I wasn't sure where to post this. I have a query that
calls a function to return a memo field when key fields
match.
I get run-time error 3077 syntax error (missing
operator) in expression. I have to keep hitting end to
get out of execution. It looks like some rows of query
are processed though. Does anyone know what is causing
this?
Some of the parameters passed to the function are
blank. Is this the reason?
Any help appreciated.
 
G

Guest

I think I know what is causing my error, but not sure
how to fix it. One of the parameters that gets passed to
the function is a text field. Some of the entries contain
single or double quotes in the data.
The function that I wrote uses rec.findfirst, and
tries to match table columns to the parameters that were
passed. I can't enclose my parameters in single or double
quotes, since they may be contained in the actual data.
Help!

Thanks
 
V

Van T. Dinh

If you use double-quotes as String delimiter, use the Replace() function to
replace the double-quote in your String with TWO double-quotes. For
example, from the Debug window:

StrWithDQ = "Here is the DQ "" and some more text"
?StrWithDQ
Here is the DQ " and some more text
?Replace(StrWithDQ, """", """""")
Here is the DQ "" and some more text

When the last line is enclosed in your double-quotes in FindFirst, the two
double-quotes will be interpreted as a single character double-quote and not
the String delimiter symbol.
 
G

Guest

Thank you, Van. I got it working now.
-----Original Message-----
If you use double-quotes as String delimiter, use the Replace() function to
replace the double-quote in your String with TWO double- quotes. For
example, from the Debug window:

StrWithDQ = "Here is the DQ "" and some more text"
?StrWithDQ
Here is the DQ " and some more text
?Replace(StrWithDQ, """", """""")
Here is the DQ "" and some more text

When the last line is enclosed in your double-quotes in FindFirst, the two
double-quotes will be interpreted as a single character double-quote and not
the String delimiter symbol.

--
HTH
Van T. Dinh
MVP (Access)






.
 

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