Recordset Open Problem

lfazenbaker

New member
Local time
Today, 11:11
Joined
Sep 16, 2005
Messages
7
Someone please tell me what is wrong with this code? (I have already defined db_file earlier in the sub.)

' Open a connection.
Set conn = New ADODB.Connection
conn.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & db_file & ";" & _
"Persist Security Info=False"
strSQL = "SELECT * FROM Families"
conn.Open

' Open Families Table with a cursor that allows updates
Set rs = New ADODB.Recordset
rs.Open strSQL, conn, adOpenKeyset, adLockOptimistic, adCmdTable


This is the error I get. "Microsoft JET Database Engine --> Syntax Error in FROM Clause"

Thanks!
 
Recordset Open Problem resolved

Nevermind. I figured it out. For anyone who's having a similar problem, this is the solution.

I had to change the SQL statement. Instead of a whole statement, I just needed to put the name of the table inside the quotes.

Thanks.
 

Users who are viewing this thread

Back
Top Bottom