Problems using ADO on tables with space in table name

R

Roger Eriksen

Hi

I am converting an Access application from DAO to ADO.
Some of the tables has spaces in the table name. I get "Invalid SQL
Statement" when trying to open.
Code looks like this:

Dim rs As New ADODB.Recordset
rs.Open "Important Customers", CurrentProject.Connection, adOpenStatic

Any ideas?
My Access application has a reference to MSADO15.DLL.

Regards
Roger
 
D

David Lloyd

Roger:

I don't have ADO 1.5 available, however, the following works with ADO 2.0:

Dim rs As New ADODB.Recordset
rs.Open "[Important Customers]", CurrentProject.Connection, adOpenStatic

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.


Hi

I am converting an Access application from DAO to ADO.
Some of the tables has spaces in the table name. I get "Invalid SQL
Statement" when trying to open.
Code looks like this:

Dim rs As New ADODB.Recordset
rs.Open "Important Customers", CurrentProject.Connection, adOpenStatic

Any ideas?
My Access application has a reference to MSADO15.DLL.

Regards
Roger
 
M

Martin Walke

Hi Roger,

Surround any table name, field name with square brackets [] and I would also
recommend you lift your ADO version to at least 2.5.

HTH
Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top