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