Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADO question

Status
Not open for further replies.

DantanaSwat

IS-IT--Management
Dec 3, 2003
29
US
I get a syntax error in this FROM line
Database called inventory.mdb and im trying to open the General table for updating

Set Domain = GetObject("WinNT://mydomain")
Domain.Filter = Array("computer")
Const adOpenStatic = 3
Const adLockOptimistic = 3

Set objConnection = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.Recordset")

objConnection.Open _
"Provider = Microsoft.Jet.OLEDB.4.0; " & _
"Data Source = Inventory.mdb"

objRecordSet.Open "SELECT * FROM General", _ <<Syntax error in FROM clause
objConnection, adOpenStatic, adLockOptimistic
objRecordSet.MoveFirst
 


GENERAL is a reserved word in Access. If you want to use it as a table name, enclose it in brackets...

"SELECT * FROM [GENERAL]"

I like to stay away from reserved words for either table or column names...



Mark

&quot;You guys pair up in groups of three, then line up in a circle.&quot;
- Bill Peterson, a Florida State football coach
 
also looks like you're missing the line continuation there

objRecordSet.Open "SELECT * FROM [General]", &_ <<Syntax error in FROM clause
objConnection, adOpenStatic, adLockOptimistic

___________________________________________________________________

The answer to your ??'s may be closer then you think.
Check out Tek-Tips knowledge bank by clicking the FAQ link at the top of the page
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top