invalid column name

D

David McDivitt

I have an ADO recordset opened in code. Upon using the .update method I get
an error saying "invalid column name". No error occurs when I assign values
to fields in the recordset, which is strange, but only when I do the update
method. It only happens on one field, too. If I skip assigning a value to
that field, though I still assign values to other fields, the update method
works OK.

I am using Access97 with a reference to ADO, which I do all the time, and
this is the first problem I've had. I tried renaming the one field with
enterprise manager, to something else, and that doesn't work. For the DAO
part I did delete links and recreate, but as I said I am using ADO with a
connection object, so whatever linked tables don't make any difference.
Thoughts would be appreciated, thanks.
 
B

Bob

Are the names you are using for the field reserved words or have spaces? Have you tried putting the name in brackets like rst![FieldName]?
 
D

David McDivitt

Bob,

The names do not have spaces and are not reserved words. I tried different
names. I also tried brackets. The strange thing is that the error occurs
when doing the update method, and not when assigning a value to the field.
When the error occurs, I can print the value of the supposedly bad field
name in the debug window.

I am going to try cloning the field in the table, populating the cloned
field, deleting the original, then using the new field instead. This is not
production data so I can do whatever I want to it, but after getting these
changes made it must work on production data, too.
From: Bob <[email protected]>
Subject: RE: invalid column name
Date: Tue, 20 Jan 2004 19:16:07 -0800

Are the names you are using for the field reserved words or have spaces? Have you tried putting the name in brackets like rst![FieldName]?
Subject: invalid column name
Date: Tue, 20 Jan 2004 17:03:04 -0600

I have an ADO recordset opened in code. Upon using the .update method I get
an error saying "invalid column name". No error occurs when I assign values
to fields in the recordset, which is strange, but only when I do the update
method. It only happens on one field, too. If I skip assigning a value to
that field, though I still assign values to other fields, the update method
works OK.

I am using Access97 with a reference to ADO, which I do all the time, and
this is the first problem I've had. I tried renaming the one field with
enterprise manager, to something else, and that doesn't work. For the DAO
part I did delete links and recreate, but as I said I am using ADO with a
connection object, so whatever linked tables don't make any difference.
Thoughts would be appreciated, thanks.
 
D

David McDivitt

I resolved this problem. The field being updated was on the one-side of a
one-to-many relationship. Fields on the many-side update OK.

My goal is to use a single recordset for both display and updating, other
than use of a subform. In past a listbox was used, which was one recordset,
the one-side table was opened as a second recordset, and the many-side table
opened as a third. The three were kept synchronous using the listbox
after_update event and a unique hidden field in the listbox. A subform would
have been nice since it gave better formatting control, but a whole line
across cannot be highlighted. I saw some code for that and tried it, but on
each record selection, all visible rows recalculate again, which is very
slow. The method now is to have a recordset open in code, and use a custom
made grid control which populates itself by firing events back into the
parent. Works pretty well. Unfortunately I will not be able to make changes
to the one-side of the recordset immediately visible on the display. Since
there may be several hundred thousand rows, sorted this way or that, doing
constant refreshes of the recordset is not an option. I would appreciate
suggestions on this. Thanks
Subject: Re: invalid column name
Date: Wed, 21 Jan 2004 08:54:25 -0600

Bob,

The names do not have spaces and are not reserved words. I tried different
names. I also tried brackets. The strange thing is that the error occurs
when doing the update method, and not when assigning a value to the field.
When the error occurs, I can print the value of the supposedly bad field
name in the debug window.

I am going to try cloning the field in the table, populating the cloned
field, deleting the original, then using the new field instead. This is not
production data so I can do whatever I want to it, but after getting these
changes made it must work on production data, too.
From: Bob <[email protected]>
Subject: RE: invalid column name
Date: Tue, 20 Jan 2004 19:16:07 -0800

Are the names you are using for the field reserved words or have spaces? Have you tried putting the name in brackets like rst![FieldName]?
Subject: invalid column name
Date: Tue, 20 Jan 2004 17:03:04 -0600

I have an ADO recordset opened in code. Upon using the .update method I get
an error saying "invalid column name". No error occurs when I assign values
to fields in the recordset, which is strange, but only when I do the update
method. It only happens on one field, too. If I skip assigning a value to
that field, though I still assign values to other fields, the update method
works OK.

I am using Access97 with a reference to ADO, which I do all the time, and
this is the first problem I've had. I tried renaming the one field with
enterprise manager, to something else, and that doesn't work. For the DAO
part I did delete links and recreate, but as I said I am using ADO with a
connection object, so whatever linked tables don't make any difference.
Thoughts would be appreciated, thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top