Subform reference problem

G

Guest

hi

I have a main form that has a combobox, and a subform with many textboxes.
Depending which selection I make from the combobox, its AfterUpdate event
code disables several of the subform's textboxes. What frequently happens
when I use the combobox is that I get error 2164: "You can't disable a
control while it has the focus". I take it the subform and the main form
each have their own focus. If I manually click in a textbox that I know
won't be disabled, then all is OK when I use the combobox. I 'd like the
AfterUpdate code to move the focus to a 'safe' place, (something like
Forms!frmMain!sfrmSub.Form.SetFocus) but I can't get the reference syntax
correct. Any clues?
 
G

Guest

oops! - I was trying to move focus to another textbox that was not enabled.
So, I've added a 'dummy' textbox whose only purpose in life is to park the
subform's focus when I'm using the Main form.

Forms!frmMain!sfrmSub.Form!txtDummy.SetFocus

Is there a more standard approach??
 
M

Marshall Barton

cinnie said:
oops! - I was trying to move focus to another textbox that was not enabled.
So, I've added a 'dummy' textbox whose only purpose in life is to park the
subform's focus when I'm using the Main form.

Forms!frmMain!sfrmSub.Form!txtDummy.SetFocus

Is there a more standard approach??


That is the standard approach when there is no other control
that will serve the purpose. I normally set the dummy text
box's Height to 0 and Locked to Yes so it can't be seen and
to prevent users from inadvertently typing something in it.
 

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