By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,847 Members | 3,081 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,847 IT Pros & Developers. It's quick & easy.

Cannot access form fields from VBA

P: n/a
Hello.

I have an MS Access 2000 form whose fields I need to read and
write from VBA. The fields are data-bound, using a query that has
been defined and saved in my Access database. The query uses
local data only (no external references.)

This worked fine until I added some additional fields to the
recordset. The new fields do not show up in the object browser,
and I get an error if I try to use them. This problem occurs whether
or not the new fields are bound to textboxes on the form.

The old fields continue to show up in the object browser, and I can
read and write to them from VBA as I always have.

Any suggestions?

Thanks
-Mark
Jan 8 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Mark wrote:
Hello.

I have an MS Access 2000 form whose fields I need to read and
write from VBA. The fields are data-bound, using a query that has
been defined and saved in my Access database. The query uses
local data only (no external references.)

This worked fine until I added some additional fields to the
recordset. The new fields do not show up in the object browser,
and I get an error if I try to use them. This problem occurs whether
or not the new fields are bound to textboxes on the form.

The old fields continue to show up in the object browser, and I can
read and write to them from VBA as I always have.

Any suggestions?


Click the builder button [...] next to the RecordSource property of the form and
examine it. I suspect that the RecordSource is a query of your query rather
than the query directly and the query actually used by the form does not have
the new fields in it.

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Jan 8 '06 #2

P: n/a
Mark wrote:
Hello.

I have an MS Access 2000 form whose fields I need to read and
write from VBA. The fields are data-bound, using a query that has
been defined and saved in my Access database. The query uses
local data only (no external references.)

This worked fine until I added some additional fields to the
recordset. The new fields do not show up in the object browser,
and I get an error if I try to use them. This problem occurs whether
or not the new fields are bound to textboxes on the form.

The old fields continue to show up in the object browser, and I can
read and write to them from VBA as I always have.


I guess:

When you saved the form the field definitions were saved in its type
definitions. When you changed the query fields, the form definitions
were not changed.

I would try:

Remove the RecordSource; save the form; reset the RecordSource, resave
the form.
--
Lyle Fairfield
Jan 8 '06 #3

P: n/a
"Lyle Fairfield" <ly***********@aim.com> wrote:

I would try:

Remove the RecordSource; save the form; reset the RecordSource, resave the
form.


Yes, that did it. I also notice that when I rebuilt the RecordSource, the
builder
created it as follows:

"SELECT qry_frm_expenses_source.* FROM qry_frm_expenses_source; "

where before I had entered only the query name itself. I'm not sure whether
this is what Rick was referring to, but thank you both for your help.

-Mark
Jan 8 '06 #4

P: n/a
Mark wrote:
Yes, that did it. I also notice that when I rebuilt the RecordSource, the
builder> created it as follows:

"SELECT qry_frm_expenses_source.* FROM qry_frm_expenses_source; "


I can't think of anything terribly wrong with that but it does appear a
little clumsy. Perhaps you could avoid using the builder and just type in:

qry_frm_expenses_source

--
Lyle Fairfield
Jan 8 '06 #5

P: n/a
I would try:
remove the RecordSource; save the form; reset the RecordSource; resave
the form.

Jan 9 '06 #6

P: n/a
"Lyle Fairfield" <ly***********@aim.com> wrote:

I can't think of anything terribly wrong with that but it does appear a
little clumsy. Perhaps you could avoid using the builder and just type in:

qry_frm_expenses_source


That's what I originally had. So I guess the cure was in removing and
re-typing the recordset statement, not in modifying the statement.
As you and others suggested.
Jan 9 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.