Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
SQL statement in VBA
Hello all,
I know how to create an SQL statement in VBA, but the problem that I'm running into with this one particular database (not of my design) is that the tables and queries have names that contain spaces (i.e., Customer List). Apparently the SQL statement doesn't like the space in the table/query name. I've tried a couple of different things without success. Can anyone help with with this problem? Thanks, Mike. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
SQL statement in VBA
Have you tried recording a macro using Get external data. You can then look
at the SQL portion and get some hints. I think the answer is to use single quotes, but don't do that much with SQL. -- Regards, Tom Ogilvy "Michael Malinsky" wrote in message ups.com... Hello all, I know how to create an SQL statement in VBA, but the problem that I'm running into with this one particular database (not of my design) is that the tables and queries have names that contain spaces (i.e., Customer List). Apparently the SQL statement doesn't like the space in the table/query name. I've tried a couple of different things without success. Can anyone help with with this problem? Thanks, Mike. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
SQL statement in VBA
Roedd <<Michael Malinsky wedi ysgrifennu:
I know how to create an SQL statement in VBA, but the problem that I'm running into with this one particular database (not of my design) is that the tables and queries have names that contain spaces (i.e., Customer List). Apparently the SQL statement doesn't like the space in the table/query name. I've tried a couple of different things without success. Can anyone help with with this problem? What couple of things? You're in danger here of getting loads of replies with stuff you've already tried. Put the field names in [] square brackets. -- Rob http://www.asta51.dsl.pipex.com/webcam/ This message is copyright Robert Bruce and intended for distribution only via NNTP. Dissemination via third party Web forums with the exception of Google Groups and Microsoft Communities is strictly prohibited and may result in legal action. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
SQL statement in VBA
Roedd <<Robert Bruce wedi ysgrifennu:
Put the field names in [] square brackets. Oh dear. Typo. I meant Table and/or query names, though I generally put all Field, Table AND query names in square brackets just to be on the safe side - Jet in particular has some obscure and seemingly ever-changing reserved words. -- Rob http://www.asta51.dsl.pipex.com/webcam/ This message is copyright Robert Bruce and intended for distribution only via NNTP. Dissemination via third party Web forums with the exception of Google Groups and Microsoft Communities is strictly prohibited and may result in legal action. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
SQL statement in VBA
Tom,
Thanks for that suggestion. The answer was to enclose the table/query name in backticks (``). Mike. |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
SQL statement in VBA
Thanks for coming back with that. I have to confess that is what I was
thinking of, but didn't know what to call them or really exactly what they were (and hoped single quotes would work as well). <g -- Regards, Tom Ogilvy "Michael Malinsky" wrote in message oups.com... Tom, Thanks for that suggestion. The answer was to enclose the table/query name in backticks (``). Mike. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
IF statement inside a SUMIF statement.... or alternative method | Excel Worksheet Functions | |||
Reconcile Bank statement & Credit card statement & accounting data | Excel Worksheet Functions | |||
Embedding an OR statement in an IF statement efficiently | Excel Discussion (Misc queries) | |||
appending and IF statement to an existing IF statement | Excel Worksheet Functions | |||
If statement and Isblank statement | Excel Worksheet Functions |