Open form in dialog mode

B

Beth

Hi,
I have an invoice form that has a button on it for adding a new sales item
if the one the user needs isn't there. The button should open the sales
item form in dialog mode so that when I close the pop up form I can have
some refresh code run on the invoice so that the combo box updates to
include that new item.
The problem is that when I open the new form in dialog mode the window opens
to full screen, across the Windows taskbar at the bottom of the screen.
Also, my navigation buttons in the form footer get hidden sometimes.

Can anyone tell me what to do to avoid this problem?

Here is the call I am using to open the pop-up form.

DoCmd.OpenForm "SalesItems", , , , acFormAdd, acDialog

Thanks in advance,
Beth
 
A

Albert D. Kallal

I would suggest that you simply open the form as model, and NOT dialog.

when you *close* the form, then you can have the form SalesItems do a
requery on the combo box.
(use the after update event of SalesItems, or even the close event....

eg:

Forms!NameOfForm.NameOfComboBox.Requery

*
 
J

J_Goddard via AccessMonster.com

Albert -

I think the dialog mode is needed in this case. Correct me if I'm wrong, but
you need to use dialog to stop the code while the form is open, so that the
data can be added before continuing. Using dialog opens the form as modal
and popup in any case.

John


I would suggest that you simply open the form as model, and NOT dialog.

when you *close* the form, then you can have the form SalesItems do a
requery on the combo box.
(use the after update event of SalesItems, or even the close event....

eg:

Forms!NameOfForm.NameOfComboBox.Requery

*

--
John Goddard
Ottawa, ON Canada
jrgoddard at cyberus dot ca

Message posted via AccessMonster.com
 
A

Albert D. Kallal

J_Goddard via AccessMonster.com said:
Albert -

I think the dialog mode is needed in this case. Correct me if I'm wrong,
but
you need to use dialog to stop the code while the form is open, so that
the
data can be added before continuing. Using dialog opens the form as modal
and popup in any case.

Well, that assumes that you have code *right* after the openform that ONLY
should run when the user is done.

The simply solution here is to move the code that supposed to run *after*
the form is done, and have the closing form *run* (call) that code.

if you don't actually have code that runs right after the openform command,
then you don't need dialog anyway.

So, either you

a) place the additional code you need to run in the 2nd forms close event,
b) or, simply have the forms close event call that additional code you
needed to run after the openform (you thus move the code to a separate sub,
and make it public

eg:

call forms!nameOfFirstForm.NameOfSubThatNeedsToRunAfterUserIsDone

It really depends on how much code you need to run after the user is
done...if it is just a combo re-query, then you can place that code in the
2nd forms close event.
 
B

Beth

Thank you to both contributors. In this case, there is only the one line
requery. However, I have another situation that will require a great deal
of code after the openform command.
I am going to use both suggestions, but for different problems.
I am happy to go away from the modal form.

Beth
 

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