Help with Opening ADODB.Recordset

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to open a table which contains a password using the
ADODB.Recordset feature. For some reason the following code comes back with
the error - (Run-time error -'2137217900 (80040e14)' Invalid SQL Statement;
expected DELETE, INSERT or UPDATE.):

Dim rstPassword As New ADODB.Recordset
Dim con As New ADODB.Connection
Dim stPassword As String
Dim ccn As New ADODB.Connection
Set ccn = CurrentProject.Connection

rstPassword.Open "tbl Password", ccn, adOpenKeyset, adLockOptimistic

"tbl Password" is a table in the database. Any help is appreciated
 
JR_06062005 wrote in message
I'm trying to open a table which contains a password using the
ADODB.Recordset feature. For some reason the following code comes back with
the error - (Run-time error -'2137217900 (80040e14)' Invalid SQL Statement;
expected DELETE, INSERT or UPDATE.):

Dim rstPassword As New ADODB.Recordset
Dim con As New ADODB.Connection
Dim stPassword As String
Dim ccn As New ADODB.Connection
Set ccn = CurrentProject.Connection

rstPassword.Open "tbl Password", ccn, adOpenKeyset, adLockOptimistic

"tbl Password" is a table in the database. Any help is appreciated

Try specifying a commandtypeenum

rstPassword.Open _
"tbl Password", ccn, adOpenKeyset, adLockOptimistic, adcmdtable
 
I think I've discovered the problem. The table name (for some reason) cannot
have a space in it. When I use the same code with the table renamed to
"tblPassword", it works. Your suggestion may get around this problem, but
I'm not sure what a commandtypeenum is.
 
Actually, putting square brackets around it should have solved the problem,
but not having spaces is strongly recommended.

rstPassword.Open "[tbl Password]", ccn, adOpenKeyset, adLockOptimistic
 
Back
Top