How to pause for input in a while loop

B

Boon

Hi,

I have a while loop like the one below

While i<=10 do

docmd.openform "FormA", ....
i=i+1
loop


I want the loop to stop after formA is open. (So that I will ask for
information in form A and update the table through SQL code -
docmd.runsql.... How can I do this?


Thanks,
 
B

Boon

It will loop throught number 1 to 10 and I would like the user input data
for each one of them.
 
G

Graham Mandeno

Hi Boon

If you open the form in dialog mode (aka modally) then your code execution
will be suspended until Form! is either closed or made invisible.

Use the WindowMode argument for OpenForm, which is the sixth argument.

Either:
DoCmd.OpenForm "FormA", , , , ,acDialog

Or use a named argument:
DoCmd.OpenForm "FormA", WindowMode:=acDialog
 
B

Boon

thanks,

This acDialog works great!

Graham Mandeno said:
Hi Boon

If you open the form in dialog mode (aka modally) then your code execution
will be suspended until Form! is either closed or made invisible.

Use the WindowMode argument for OpenForm, which is the sixth argument.

Either:
DoCmd.OpenForm "FormA", , , , ,acDialog

Or use a named argument:
DoCmd.OpenForm "FormA", WindowMode:=acDialog

--
Good Luck :)

Graham Mandeno [Access MVP]
Auckland, New Zealand


Boon said:
Hi,

I have a while loop like the one below

While i<=10 do

docmd.openform "FormA", ....
i=i+1
loop


I want the loop to stop after formA is open. (So that I will ask for
information in form A and update the table through SQL code -
docmd.runsql.... How can I do this?


Thanks,
 

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