Code bombs if I update it to reflect field name changes.

F

FredFred

I'm old to Access and new to access programming.

An event procedure never seems to recognize the new names of renamed fields.
In fact, it does recognize and access renamed fields by their previous
names. (So, this isn't the usual error of failing to update the code to
reflect field name changes, it's sort of the opposite)

For example, lets say I change a field name in the table from FieldA to
FieldB. If I update it's call in the code from FieldA to FieldB, it errors
out saying "can't find field". But if I use the previous (now gone)
"FieldA" field name in the code it accesses the field just fine.

Using Access 2003.
 
D

Douglas J. Steele

I suspect that your form is based on a query, and you haven't updated the
query to reflect the changes to the table.
 
F

FredFred

Dear Doug,

Thanks for the idea. But the report came directly from the table. But
your answer helps me focus on where I need to look harder and experiment
more. Now I can't seem to replicate the behaviour that I was sure I
established. A new variable is that if I have a second use of that field in
the same section it seems to see it, and if not, not.

Thanks again.

Sincerely,

Fred
 
F

FredFred

Doug,

Further to my last post I experimented more. I'm trying to put code in the
"on format" in a report detail section. to make an image box show the image
pointed to by the pat in a field. I misunderstood what was happening. My
code NEVER sees the field, except that having unless I have a second use of
the field in that section, it was able to see it. And through autocorrect or
something, that other control was serving as a translater / link. So, now I
know what was happenning but not how to make code see a field. A newbie
error I'm sure.

Fred
 
R

Rick Brandt

FredFred said:
Doug,

Further to my last post I experimented more. I'm trying to put code
in the "on format" in a report detail section. to make an image box
show the image pointed to by the pat in a field. I misunderstood
what was happening. My code NEVER sees the field, except that having
unless I have a second use of the field in that section, it was able
to see it. And through autocorrect or something, that other control
was serving as a translater / link. So, now I know what was
happenning but not how to make code see a field. A newbie error I'm
sure.

A quirk of Access reports. Even though they are in the RecordSource you
cannot refer to a field unless it is used as a ControlSource somewhere in
the report. I just add TextBoxes that use them as ControlSources and then
set them to not be visible.
 

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