Main Form Focus with Sub Forms

  • Thread starter Thread starter Rick
  • Start date Start date
R

Rick

I posted this a few weeks back but never received a
solution. Here is my problem:

I have several hidden sub forms in a main form. When I
click on a text field in the main form, a sub form is
supposed to be visible and this works.

Problem is, after I have worked in the sub form and I want
to move to another sub form, I select another text field
in the main form with the following code:

Form1.Visible = False
Form2.Visible = True

But Access 2003 gives me a pop up window stating I cant
hide the form with current focus. I tried to change the
focus me.text1.setfocus and this doesn't work.

Is there anyway I can do this using a text field in the
main form as my select option? I have done this with a
drop box but I don't want to use a drop boxy, I want to
use a text field to give it a web page feel.

Any suggestions?
 
Rick said:
I have several hidden sub forms in a main form. When I
click on a text field in the main form, a sub form is
supposed to be visible and this works.

Problem is, after I have worked in the sub form and I want
to move to another sub form, I select another text field
in the main form with the following code:

Form1.Visible = False
Form2.Visible = True

But Access 2003 gives me a pop up window stating I cant
hide the form with current focus. I tried to change the
focus me.text1.setfocus and this doesn't work.

Is there anyway I can do this using a text field in the
main form as my select option? I have done this with a
drop box but I don't want to use a drop boxy, I want to
use a text field to give it a web page feel.

You need to explain the objects and their names before we
can understand the problem you're having. What is Form1?
Where is that code located, in the subform or in the main
form?

If the code is in the first subform and form1 is the first
subform control, then you'll have to set the focus to a text
box on the main form before you can make the subform control
invisible:
Me.Parent.sometextbox.SetFocus
 
What you are describing sounds like a tab control. If a tab control does not
look like what you want, there are some options for them that might get you
what you want. I don't know for sure that you can change the relevant option
for an Access tab control, but I assume it is possible. You can make the tab
control use buttons such as the Windows Taskbar (which is a tab control)
does.

If you are still looking for solutions then it will probably help to explain
what you mean by "web page feel".
 
Back
Top