running code after opening and closing a different form

running code after opening and closing a different form

am 17.01.2008 04:18:56 von PW

Hi,

I do not get why sometimes code does not run "in order".

I open another form within an open form:

DoCmd.openform "frmReservationEntry", , , "[ResieNum] = " & varResID

The form opens with the correct reservation record. I close that form
and I expect the following two procedures to run, but they don't.
Why won't this code run???:

PopTable_pw
BuildCalendar_pw

-paulw

Re: running code after opening and closing a different form

am 17.01.2008 04:40:10 von Dominic Vella

You may need to set the Dialog flag to prevent the following code from
executing till after the form is closed,
docmd.OpenForm "frmReservationEntry",,,"[ResieNum] = " & varResID,,acDialog

Dominic

"PW" wrote in message
news:nuhto3p6f19rka0r4i06ahbh903qersf5q@4ax.com...
> Hi,
>
> I do not get why sometimes code does not run "in order".
>
> I open another form within an open form:
>
> DoCmd.openform "frmReservationEntry", , , "[ResieNum] = " & varResID
>
> The form opens with the correct reservation record. I close that form
> and I expect the following two procedures to run, but they don't.
> Why won't this code run???:
>
> PopTable_pw
> BuildCalendar_pw
>
> -paulw

Re: running code after opening and closing a different form

am 17.01.2008 19:20:18 von PW

On Thu, 17 Jan 2008 14:40:10 +1100, "Dominic Vella"
wrote:

>You may need to set the Dialog flag to prevent the following code from
>executing till after the form is closed,
>docmd.OpenForm "frmReservationEntry",,,"[ResieNum] = " & varResID,,acDialog
>
>Dominic
>

But that makes the form modal (?). The reservation form launches
other forms and they can not be accessed as the reservation form stays
on top.

-pw

>"PW" wrote in message
>news:nuhto3p6f19rka0r4i06ahbh903qersf5q@4ax.com...
>> Hi,
>>
>> I do not get why sometimes code does not run "in order".
>>
>> I open another form within an open form:
>>
>> DoCmd.openform "frmReservationEntry", , , "[ResieNum] = " & varResID
>>
>> The form opens with the correct reservation record. I close that form
>> and I expect the following two procedures to run, but they don't.
>> Why won't this code run???:
>>
>> PopTable_pw
>> BuildCalendar_pw
>>
>> -paulw
>

Re: running code after opening and closing a different form

am 18.01.2008 08:48:49 von Dominic Vella

The only other reason I can think of is that there may be some error in the
code on the new form that did not include Error Handling.
If an error occurs, the code will go to the last error handling routine,
which in your case may be in the main form.

Might be best to put a code break in at the OpenForm command and the step
through the code (using F8) and see where it's going.


Dominic

"PW" wrote in message
news:317vo392h9g51r0stif1bihp8hdl2gekju@4ax.com...
> On Thu, 17 Jan 2008 14:40:10 +1100, "Dominic Vella"
> wrote:
>
>>You may need to set the Dialog flag to prevent the following code from
>>executing till after the form is closed,
>>docmd.OpenForm "frmReservationEntry",,,"[ResieNum] = " &
>>varResID,,acDialog
>>
>>Dominic
>>
>
> But that makes the form modal (?). The reservation form launches
> other forms and they can not be accessed as the reservation form stays
> on top.
>
> -pw
>
>>"PW" wrote in message
>>news:nuhto3p6f19rka0r4i06ahbh903qersf5q@4ax.com...
>>> Hi,
>>>
>>> I do not get why sometimes code does not run "in order".
>>>
>>> I open another form within an open form:
>>>
>>> DoCmd.openform "frmReservationEntry", , , "[ResieNum] = " & varResID
>>>
>>> The form opens with the correct reservation record. I close that form
>>> and I expect the following two procedures to run, but they don't.
>>> Why won't this code run???:
>>>
>>> PopTable_pw
>>> BuildCalendar_pw
>>>
>>> -paulw
>>