SQL Query Feature/Bug ? 
Author Message
 SQL Query Feature/Bug ?

I'm trying to access a table in an Access database. The table is
called "NT Server Audit"

My query is built thus :

NT_Server_Audit = "NT Server Audit"
SQL3 = "select * from " & NT_Server_Audit & ""
.
.
.
Set NTAPCC = WNT_db.OpenRecordset(SQL3, dbOpenDynaset)

This gives me a run time error of 3131 (Syntax error in from clause),
yet if l display the SQL3 string in a message box it is displayed
correctly. I know it's because of the spaces in the table name.

Is there any way to get round this other than changing the name of the
table ?

--
Chris O'Neill

Zeneca Computing & Telecommunications



Sun, 24 Jan 1999 03:00:00 GMT  
 SQL Query Feature/Bug ?

Quote:

> I'm trying to access a table in an Access database. The table is
> called "NT Server Audit"

> My query is built thus :

> NT_Server_Audit = "NT Server Audit"
> SQL3 = "select * from " & NT_Server_Audit & ""
> .
> .
> .
> Set NTAPCC = WNT_db.OpenRecordset(SQL3, dbOpenDynaset)

> This gives me a run time error of 3131 (Syntax error in from clause),
> yet if l display the SQL3 string in a message box it is displayed
> correctly. I know it's because of the spaces in the table name.

> Is there any way to get round this other than changing the name of the
> table ?

> --
> Chris O'Neill

> Zeneca Computing & Telecommunications


Try this...

NT_Server_Audit = "[NT Server Audit]"

or...

SQL3 = "select * from [NT Server Audit]"

and then plug and play!  In some way, shape, or fashion you
gotta work the brackets into the fray.  In Access, these
tell the database engine to ignore the spaces used in field
and table names.  Hope this helps!

Regards,

The Doktor



Mon, 25 Jan 1999 03:00:00 GMT  
 SQL Query Feature/Bug ?

If you have spaces in your table or fields, then you need to surround them
with brackets [ ].

Try:    SQL3 = "Select * from [" & NT_Server_Audit & "]"



Quote:
> I'm trying to access a table in an Access database. The table is
> called "NT Server Audit"

> My query is built thus :

> NT_Server_Audit = "NT Server Audit"
> SQL3 = "select * from " & NT_Server_Audit & ""
> .
> .
> .
> Set NTAPCC = WNT_db.OpenRecordset(SQL3, dbOpenDynaset)

> This gives me a run time error of 3131 (Syntax error in from clause),
> yet if l display the SQL3 string in a message box it is displayed
> correctly. I know it's because of the spaces in the table name.

> Is there any way to get round this other than changing the name of the
> table ?

> --
> Chris O'Neill

> Zeneca Computing & Telecommunications




Wed, 27 Jan 1999 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. how can I build 2 queries in 1 query(VB SQL query)

2. DoCmd.Close (Bug or Feature?)

3. ACCESS 95/97 BUG/FEATURE, CAN YOU HELP ?

4. Word MailMerge - a bug or a feature

5. bug or feature with expression columns

6. CType(), Bug or Feature??

7. Bug or Feature?

8. Windows bug or feature?

9. Free online bug report / feature enhancement tracking

10. VB6 IDE Bug/Feature?

11. VB5 SP3 bug or feature?

12. RichTextBox BUG or feature?

 

 
Powered by phpBB® Forum Software