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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

halt process when the form is open 1

Status
Not open for further replies.

davyre

Programmer
Oct 3, 2012
197
AU
I got a code that uses many IF conditions. Here's the basic structure:
Code:
do while unitRS.EOF=false
IF Stock>Order THEN
 'msgbox ("Stock is enough")
ELSEIF Stock=Order THEN
 'msgbox ("Stock is enough, stock is now 0")
ELSEIF Stock<Order AND Stock>0 THEN
 'msgbox ("Stock is not enough, order some?")
 docmd.openform "FrmOrderUnit"
ELSEIF Stock=0 THEN
 'msgbox ("Stock is 0, order some?")
 docmd.openform "FrmOrderUnit"
END IF
unitRS.movenext
loop

the problem I have is that when the stock is low (go to 3rd IF), it would open form FrmOrderUnit. But as soon as the form opened, the program continues to check the next item and would open the form again, thus give me error message:
runtime error 3211 : the database could not lock table "TblOrderUnit" because it is in use by another person or process

How do I set that if the form is opened, the process stops running until I have do something with that form?

THanks!
 
DoCmd.OpenForm "FrmOrderUnit", , , , ,acDialog

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top