Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to make a form behave like an Inputbox 1

Status
Not open for further replies.

davidoff123

Programmer
Aug 5, 2003
2
DE
Hi,

I am using a loop in my procedure which pops up 3 Inputboxes. The loop waits until the the user fills in some values and continues to work with those values after that:

Do Until ...

'some code ...

name=Inputbox("Name of the employee: ", "name"
firm=Inputbox("Firm of the employee: ", "firm")
id=Inputbox("ID of the employee:", id")

'some code ...

Loop

How can I replace these 3 Inputboxes by 1 Form that causes the Loop to stop and wait for the values to be entered?

The problem is that the loop continues with the next iteration after opening a form e.g. with Docmd.Openform. However, the next iteration may be dependent on what the user has entered into the form.

Thanks for your help
 
call the form specifying acModal as the last parameter to the openform command

The way I got around this was "On Close" to save the values to a global variable and then read the variable after the form returns. You can build checks into the form to ensure that the data is valid before you allow the exit to proceed
 
I think acDialog is the parameter you need, Modal would be similar but it's a property of the form itself.
--jsteph
 
Thanks, jsteph. I had the same question, and this worked perfectly.

David
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top