Re: Dlookup function criteria w/wo single quotes

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Yes, Pamphlet is a text field. Do I use single or double quotes?

When I use single quotes it works fine but I get into trouble because
one of the pamphlets has a single quote (') in its description.
I remember an example in these postings of double quote (")
and I recall """ ie 3 (") but can't find the post now.
How would the criteria look? "[Pamphlet] = """ & Forms!...?

And yes it was the same database in both cases.
With their permission I take a copy of the database from their
site to my laptop.

Thanks,
Doug

"Douglas J. Steele" wrote:

Assuming Pamphlet is a text field, the quotes are necessary.

It's been that way in all versions of Access. I can't understand why it
would work on one machine and not the other, assuming you're talking about
the same database in both cases.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Doug F." <DougF@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:CA656D48-37B8-474B-8936-A296EA53A409@xxxxxxxxxxxxxxxx
I have Dlookup:
That WORKS:(this has single quotes around the criteria)
myRequireItemNo = DLookup("[RequireItemNo]", "V$Pamphlets", "[Pamphlet] =
'"
& Forms![#10 Pamphlets]![subform #10B PamphletOrdersDetails]!Combo7 & "'")
'

That FAILS:(this has no single quotes around criteria)
myRequireItemNo = DLookup("[RequireItemNo]", "V$Pamphlets", "[Pamphlet] =
"
& Forms![#10 Pamphlets]![subform #10B PamphletOrdersDetails]!Combo7)

A client site runs the FAILS version ok with MS Access 2003 11.6566.8132,
when I
run it on my machine MS Access 11.5614.5606 it fails, sorry I don't have
the
msg
at this moment. Thoughts?

Thanks,
Doug









.



Relevant Pages

  • Possible "bug" found in gnatcoll-sql_impl.adb
    ... I end up with more characters than I've bargained for. ... I end up with Peter in the database. ... extra single quotes added to all my string data. ...
    (comp.lang.ada)
  • Re: Syntax error (missing operator) in query expression
    ... > and how to use single quotes and double quotes in ASP? ... expression to "scrub" the search term prior to constructing the SQL ... query depending on your database environment) instead of dynamically ... constructing the SQL statement. ...
    (microsoft.public.inetserver.asp.general)
  • Re: SQL Injection
    ... Make sure you always escape single quotes and other magic characters when ... you enter data into your database. ...
    (borland.public.delphi.non-technical)
  • Re: What Did I Miss Here?
    ... Is the Use Quoted Identifiers option checked in your database property sheet ... under the Options tab? ... > In the database it is being stored as two single quotes. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Need a Strategy to store the Single Quotes in the Database
    ... >> Database where if i try to Store the String value with Single Quotes ... >> then it is throwing the error as SQL String Truncated. ...
    (microsoft.public.dotnet.languages.vb)