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!

Creating a Recordset from an Excel Spreadsheet

Status
Not open for further replies.

johnnyN

MIS
May 1, 2002
1
US
Hello,
I'm trying to create a recordset in vb from data stored in an Excel spreadsheet. I've defined an ODBC DSN to the spreadsheet. I've used to following code in VB to try and set up the recordset:

With rs_TAIBCITY
.CursorType = adOpenStatic
.LockType = adLockOptimistic
.ActiveConnection = cn_TAIBCITY
.Open "select * from TAIBCITY"
End With

In the past I've been able to run SQL queries on Excel files if I select the columns of interest in Excel and do an insert/name, and give it a name (This name then acts as the table name for the SQL statement.

However, given all this, I still get an error stating that:

Runtime error '3001'
Arguments are of wrong type, are out of acceptable range, or are in conflict with one another.

Any help would be much appreciated.
-John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top