Problems using ADO on tables with space in table name

  • Thread starter Thread starter Roger Eriksen
  • Start date Start date
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
 
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
 
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
 
Back
Top