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!

Completely Frustrated!!

Status
Not open for further replies.

laakins

MIS
Feb 7, 2003
43
US
Okay, my company is currently updating everything to 2000. Therefore, I'm having to go in & change all my VB code from DAO to ADO to connect to Access 2000. Everything's been a breeze until the current code. I've changed my connection, removed my .Edit & .OpenRecordset references. Now the code compiles & all is fine until I get to where I am adding information into the database. I keep getting a 3265 "Item cannot be found in the collection corresponding to the requested name or ordinal." when I get to specific fields. It allows certain fields but not others. The field names are correct because I copied them directly from the database & they worked in DAO. I use the same syntax in other code & no problems. Not quite sure what to do now. Here is just a little bit of the code:

gdbTableO.AddNew
gdbTableO!OriginationDate = Date 'didn't like this one
gdbTableO!Acct = gAcct 'took this one
gdbTableO!FirstName = "Sue" 'didn't like this one
gdbTableO!LastName = "Smith" 'didn't like this one
gdbTableO.Update

Actually looking at it, it seems that the only thing the code recognizes the the primary key field which is the Acct field. Please help.





 
What SELECT statement did you use to Open gdbTableO? Did you specify column names in the statement?

If you used a "SELECT [columnname1], [columnname2] from gdbTableO then those two columns are the only ones that ADO knows exists, and will give you the described error if you try to add any other columns. Try "SELECT * from gdbTableO" in your Open statement and see if ADO will allow the update.

Mark

"You guys pair up in groups of three, then line up in a circle."
- Bill Peterson, a Florida State football coach
 
Could also be as simple as a typo. I noticed that where it failed the fields all two word fields concatenated together. Make sure they are not separated by spaces or underscores, etc. You can also surround the field names with square brackets [] and see if that makes a difference.

Thanks and Good Luck!

zemp
 
I used "Select * FROM tblAccountInfo". There are no typos. Like I said I copied & pasted the column names directly from the table & it worked in DAO. I'll try adding brackets & let you know.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top