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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

recordset creation problem

Status
Not open for further replies.

golyg

Programmer
Joined
Jul 22, 2002
Messages
319
Location
US
I am attempting to open a recordset like this:
Code:
tsql = "" 
tsql = "SELECT desc FROM product" 
set rs2 = dbsAMS.OpenRecordset(tsql, dbOpenSnapshot)

I created the sql query through ms access and copied it over but now i am getting a 3146 error Description: ODBC--call failed. message...

Its a MS sql server...

still working on it..

thanks
 
desc is a reservered word in SQL server. you'll have to check help on how to qualify it as a field name.

"I think we're all Bozos on this bus!" - Firesign Theatre [jester]
 
Try square brackets round the reserved word:

tsql = "SELECT [desc] FROM product"

Better yet, don't use reserved words!

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top