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

ADO AddNew Error...

Status
Not open for further replies.

martindavey

Programmer
Jan 2, 2000
122
GB
Hi,
I'm using ADO to insert a row onto my Access DB.
I'm having a problem when the column name contains a space.

I get the following error...

"Item cannot be found in the collection, etc."


...when I execute the following:

lArrayIndex[0] = 0;
vaFieldlist.PutElement(lArrayIndex,&(_variant_t("AC ID")));


I've also tried:

sprintf(temp,"\"AC ID\"");
lArrayIndex[0] = 0;
vaFieldlist.PutElement(lArrayIndex,&(_variant_t(temp)));


And I've tried:

lArrayIndex[0] = 0;
vaFieldlist.PutElement(lArrayIndex,&(_variant_t("'AC ID'")));



PS. The last part of the code is:

lArrayIndex[0] = 0;
vaValuelist.PutElement(lArrayIndex,&(_variant_t(strACID)));
m_pDestRecordSet->AddNew( vaFieldlist, vaValuelist );


All the above works if the column is called
ACID instead of AC ID

Martin :O)


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top