hiding and unhiding forms

G

Guest

I am interested in using a hidden junction table data entry form to enter
data in some fields that have been vetted from another input form that deals
with the two primary tables. The question is: can one unhide a form using
DoCmd? For example, it is very simple to use DoCmd to hide a form with
acHidden. It is possible to fill in some of the fields of that hidden form
using VBA code. However, it is not clear that DoCmd can keep the form open
and simply change the hidden parameter. It is important that the form be
kept open so that the user can continue entering additional data on it once
it becomes visible. I just want to change the hidden property. Is there a
way of doing this seamlessly?

Thanks,

LAF
 
F

fredg via AccessMonster.com

You don't need to use a DoCmd to make a form visible or not visible if it
is already open.
forms!FormName.Visible = True
or...
forms!FormName.Visible = False
will show or hide an open form.

If you wish to hide the same form that the code is written in, you can use
the Me keyword:
Me.Visible = False

Fred
 
G

Guest

Thanks much. But there is a further issue. If I desire to open the data
entry form without the user seeing it, but still being able to enter data
into it by code, would the DoCmd with acHidden be appropriate, and then use
the forms!FormName.Visible = True when the form is ready for more data to be
added to it? Is it true that the acHidden and .Visible = False produce the
same result?

All the best,

LAF
 
B

Bob Howard

I suggest that you define the form with Visible=No in the form's properties.
Your method will probably work, but form is designed to be initially hidden,
so that should be specified in the form's definition.

Regardless, you'll also need to take care that you don't set the focus
(controlname.setfocus) on any of the controls on the form while not
visible --- I think only visible forms / controls can obtain focus. When
you need to make it visible, first set the form's Visible attribute and then
do a setfocus on the control you want the cursor to be in when the form
displays. And set the tab order accordingly (so the user can tab to the
other controls i some logical manner).
 
G

Guest

Many Thanks. However, I have read in books about developing access that
forms can be used while hidden. Does this just mean that data are available
from the hidden form, or does it also mean that data can be inserted into
txtboxes on the hidden form? I guess that one way to resolve the problem is
to have both forms open, do the data insertion, and then close the first
form. My question still stands as to whether or not this can all be done in
the background, so that the second form opens with the data inserted, as the
first form is closed.

LAF
 
B

Bob Howard

I've moved data into text boxes on a hidden form and it did result in a
database update --- so I guess that works (Access 2000). I have many cases
of reading from a hidden form. Bob.

LAF said:
Many Thanks. However, I have read in books about developing access that
forms can be used while hidden. Does this just mean that data are available
from the hidden form, or does it also mean that data can be inserted into
txtboxes on the hidden form? I guess that one way to resolve the problem is
to have both forms open, do the data insertion, and then close the first
form. My question still stands as to whether or not this can all be done in
the background, so that the second form opens with the data inserted, as the
first form is closed.

LAF
 
G

Guest

Thanks, Bob

Sounds like this should solve my problem as long as unhiding a form with a
few text boxes filled in by VBA does not update upon unhiding.

Regards,

LAF
 
B

Bob Howard

It appears the database update took place when I moved the data to the
hidden form. I didn't "unhide" it to cause the update. Bob.
 

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