Square brackets.

Actually, you should be using them around every field name, whether it has
spaces or not.  It's a good habit to get into.  As well as spaces, it'll
protect you against problems where field names are the same as keywords.

> gstrSQLQuery = "SELECT * FROM [tbl_client] WHERE [Client Last Name] = '" &
> strLName & "'"


Dave S

----- Original Message ----- 
From: "Dian D. Chapman" <[EMAIL PROTECTED]>
To: "Group - ASP" <[email protected]>
Sent: Friday, March 18, 2005 6:08 PM
Subject: [ASP] Arrgghhh...quotes again!


>
> Would someone please be so kind to tell me how to handle a field name with
> spaces!<sigh>
>
> I'm trying to connect to a client's DB and they used spaces in their field
> names. I've tried a dozen combinations and I keep getting a syntax error.
>
> gstrSQLQuery = "SELECT * FROM tbl_client WHERE Client Last Name = '" &
> strLName & "'"
>
> I end up with
>
>  Run-time error '-2147217900 (80040e14)':
>
>   Syntax error (missing operator) in query expression 'Client Last Name =
> 'chapman''.
>
> I've tried quotes all over the place and can't get the @#$%^! thing right.
>
> TIA...
> Dian ~
>



---------------------------------------------------------------------    
 Home       : http://groups.yahoo.com/group/active-server-pages
---------------------------------------------------------------------
 Post       : [email protected]
 Subscribe  : [EMAIL PROTECTED]
 Unsubscribe: [EMAIL PROTECTED]
--------------------------------------------------------------------- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/active-server-pages/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to