form references not working

S

Sue D

I have some code that runs when a button is clicked (and
the code is part of the form). In it I open an Excel
spreadsheet and I use code to fill in the cells and
manipulate the data. It worked fine when I did it, but
when I gave it to 2 other people it worked for one and
not the other. I did not use the fully qualified name. In
my code I just referred to the field as AccountYear.value
and this shows a null for this one user. When I changed
it to Forms![frmMain]![AccountYear], it worked. Since the
code is on the form, shouldn't it be ok to not use the
full reference. Any ideas??
Please help. This is supposed to deploy on Monday.
Thanks,
Sue
 
A

Albert D. Kallal

Hum, I would use:

me!AccountYear

Perhaps some other code sets the data source of the form? If you do NOT have
a control on the form with the same name as the field name, then if you
CHANGE the data source of the form, then using a un-qualified field name
might give you trouble. So, I would qualify it with me!AccountYear.

I think also if I was to launch another application, I would also force a
disk write of the current form before I do this.

me.Refresh ' this forces data to disk...
 

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