Control of exit from a Form opened within a subroutine

J

jeh

A DoCmd.OpenForm statement occurs part way down my Access 2000
subroutine "Prcs". The opened form presents the user with some screen
info from which he/she must decide which of the two command buttons
"Continue" and "Quit" should be clicked. "Quit" sends execution
control elsewhere while "Continue" is designed to continue processing
within Prcs.


Sub Prcs
tested vb code ' Includes evaluation of "strCrit"
DoCmd.OpenForm "frmShowinfo", , , strCrit
more tested vb code
end sub

I've not found a way to stop control from passing straight through the
DoCmd statement on to "more tested vb code" without first requiring
the user to click on one or other of the form buttons. Could someone
please tell me the correct action here? I assume I've missed
something obvious.

TIA

John
 
T

Tom Wickerath

Hi John,

Have you tried opening your form in dialog mode? This should suspend
execution of the VBA code in Sub Prcs, until one either closes this form, or
re-opens it in hidden mode. Something like this (I'm using named arguments in
this example):

DoCmd.openForm "frmShowinfo", _
WindowMode:=acDialog, WhereCondition:=strCrit

You could then add an If / Then logic to either finish out this code, or do
something else, depending on a choice made on frmShowinfo.


Tom Wickerath
Microsoft Access MVP
https://mvp.support.microsoft.com/profile/Tom
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________
 

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