Open form in dialog mode

  • Follow


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 


0
Reply Beth 3/3/2008 7:48:06 PM

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

*

-- 
Albert D. Kallal    (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal@msn.com 


0
Reply Albert 3/3/2008 7:58:44 PM


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



Albert D. Kallal wrote:
>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
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200803/1

0
Reply J_Goddard 3/3/2008 8:50:27 PM

"J_Goddard via AccessMonster.com" <u37558@uwe> wrote in message 
news:809ea6ad81e2b@uwe...
> 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.


-- 
Albert D. Kallal    (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal@msn.com




0
Reply Albert 3/3/2008 9:47:08 PM

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

"Albert D. Kallal" <PleaseNOOOsPAMmkallal@msn.com> wrote in message 
news:eAOxhgXfIHA.5900@TK2MSFTNGP02.phx.gbl...
> "J_Goddard via AccessMonster.com" <u37558@uwe> wrote in message 
> news:809ea6ad81e2b@uwe...
>> 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.
>
>
> -- 
> Albert D. Kallal    (Access MVP)
> Edmonton, Alberta Canada
> pleaseNOOSpamKallal@msn.com
>
>
>
> 


0
Reply Beth 3/4/2008 3:28:23 AM

> I am happy to go away from the modal form.

No, actually I suggest you do use a model form, what you NOT using is a 
dialog form, and there is a GRAND CANYON of difference between the two.

You can read about that here:

http://www.members.shaw.ca/AlbertKallal/Dialog/Index.html

-- 
Albert D. Kallal    (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal@msn.com


0
Reply Albert 3/4/2008 5:41:05 PM

5 Replies
763 Views

(page loaded in 0.016 seconds)


Reply: