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

add new record to table on SQL server using ADO

Status
Not open for further replies.

AgatheB

Programmer
Jan 16, 2003
36
DK
Hi,

I'm trying to update a table with data that lies in an Excel sheet. My code lies in Excel.
I get error: 3265, "Item cannot be found in the collection corresponding to the requested name or ordinal."

Could it be because the tablename has to have a prefix or do i use a wrong method?

This is the code I am using:

....
For Jc = 1 To NosOfFields
ShColNo = Cols_to_do(Jc)
.Fields(ShWithValues.Cells(Row1, ShColNo)).Value = ShWithValues.Cells(Ic, ShColNo)
Next Jc
.Update
...
 
It sounds as the field name is not being found in the recordset object you are using.

Have checked that "ShWithValues.Cells(Row1, ShColNo)" is returning a valid field name.
 
It returns the value 'CustomerID' which is a valid name. I'm running it as a test on Northwind database, Customers table.
But is it ok to update this way, or should i do it as one SQLstring?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top