Trouble using GoToControl with subforms

  • Thread starter Thread starter RBB
  • Start date Start date
R

RBB

I have continued troubles with the subform and using
Reqery, GoToControl, SelectObject. For example I have a
Main form called MainF10 and a subForm called SubFormF11
and a combo box on the SubFormF11 called Combo14. Using MS
Knowledge base article 209689 (How to Set Focus to a
SubformUsing GoToControl) as a guide. I created a Macro

GoToControl SubformF10
GoToControl Combo14
Requery

Yet I get the error mesage
"There is not field Named Combo14 in the database in the
current record." after it reads the second GoToControl
statment.

I continuly have problems with GoToControl, SelectObject
and the like. Where can I read to understand how they
work. I tired all combination and cannot get them to work.
Thanks for help
RBB
 
Your syntax is fine, so long as you're not trying to go more than one
subform level deep.

From what action/event are you calling your macro? Which "form" or "subform"
is running it? More info, please.
 
Ken,
Thank you for the help. I am only going one level deep in
the subform. I am running the Access 2000 and the Macro
called is called by On Current Event of the Main Form
MainF10 and the and the subform SubformF11 is only one
level below. I do have a second subform on the Form but is
too is only one level deep on the subform; and is not
invloved in any way with this action. After you asked, I
have tried moving from On Current to On click an still got
the error. I have no idea of why this does not work?
Thanks for the help.
RBB

Main From: MainF10
SubformF11 .....Combo14
SubformF10A
 
I'm not sure if this is the problem, but your last post references
SubformF11, while your original post shows SubformF10 in the macro's code.
Is it possible that you're using the wrong subform name?
 
Ken,
No, Sorry I made a typing mistake in the posting not in
Access. In the posting I changed the names so the reader
could better understand. I will use the real names. I am
sure I have the names correct in Access, I have tried this
many many times. I copy and past the names to be sure of
no typos in ACCESS.

The Main form is F10 and there are two subform at the same
level; F11 (this has a combo box Combo14) and F10A. Like
this below.
Main Form: F10
Subform: F11 .....Combo14
Subform: F10A
(note subforms are one level deep on main
form)

From the main Form F10 properites I have in the EVENT
OnCurrent calling Macro4. The Macro are setup as follows.

The Macro4 is set up as follows
Macro4
GoToControl: F11
GoToControl: Combo14 (this is where the Macro stops)
ReQuery

I get the error "There is no field Named Combo14 in the
database.

Again sorry for the error.Thanks greatly for the help, I
been trying to solve this problem for months.
RBB
 
From the main Form F10 properites I have in the EVENT
OnCurrent calling Macro4. The Macro are setup as follows.

The Macro4 is set up as follows
Macro4
GoToControl: F11
GoToControl: Combo14 (this is where the Macro stops)
ReQuery

I get the error "There is no field Named Combo14 in the
database.

I think this may be a timing issue - when you change records in a main form, the
subform control does a requery in order to sync the records in the subform with
that in the main form. When this happens, there is apparently a moment when no
subform controls are available (as if the subform wasn't really there). Would it
be possible to move your call to the macro to the subform control's "OnEnter"
event?
 
Bruce,
Thanks for responding. I have some new information that
may help. As stated I have a main Form F10 and two
subforms that are at the same level. They are named F11
and F10A. I have been trying to get this to work on F11,
as this is the Form I need to requery. As a test I tried
the Macro out on F10A and it work fine, I did not get the
error. I then thought what is the difference between F11
where it does not work and F10A where it works. F11 has a
subFrom call F11Sub. Could this be the problem? I did not
mention this before because I thought it had no influence
on the issue.

As far as your recomendation, I am trying it out now. I
also thought it may be a timing issue so I placed a
message statement in the begining thinking this would stop
any timing issues. Also, I tried lauching the Macro4 by
many of the EVENTs on the Main Form. OnClick, OnEnter,
OnCurrent and could not get it to work.

I am trying to figure out how to have the GoToControl get
access to the OnEnter property. I will send results when I
get this solved.

Again, thank you very much for the help
RBB
 
Ken & Bruce,
To testing the timing theory, I ran the Macro from the
tools menu once everything had started up and was stable.
I still got the error message. "There is no field Named
Combo14 in the database." I not sure this is a good test
for the timing issue mentioned, but it is something I
tried. Again I am listing my forms and macro:
Main Form: F10
Subform: F10A
Subform: F11.......Combo box: Combo14
Sub-Subform: F11Sub

Macro4 (On Current of F10A)
GoToControl: F11
GoToControl: Combo14 (this is where the Macro stops)
ReQuery

I also tried breaking up the macro using the subForm
F11's "OnEnter" event property as Bruce suggested, and I
still got the error; but I going to try this again to be
sure I did not do anything wrong.

As a test, I put calls to Macro on the subforms OnFocus
Event property; never did the subform get focus. The
controls on the Subforms did when I click on them. I do
not think this is a problem, but thought the information
could be helpfull.
Thank for all the help.
RBB
 
Zip up a small sample of the database and email it to me
(delete this is not real from my email address) and I'll take a look.
 
Back
Top