Can a macro's execution be slowed until a control calculates?

G

Guest

I'm trying to develop a warehouse inventory application, in Access 2003, that
will run a macro to display a warning by MsgBox whenever a user attempts to
issue a larger quantity of a product from the warehouse than is currently in
inventory. I've tried creating such a macro that will begin executing On
AfterUpdate of a control named [QTY ISSUED] in my "Products Issued" form. The
macro starts by opening another form, setting value of the product IDs to
match, then going to a control where the inventory balance is calculated for
the product, and, if the condition is true that the balance is less than or
equal to zero, it displays a warning message, and if the condition is false
it closes the second form so that the "Products Issued" transactions can
resume. The macro works fine with displaying the warning MsgBox when only two
or three product transactions are in the database, or when "stepping through"
each action one at a time, but appears to execute too fast for the calculated
control to "refresh" in time to be "read accurately" when run normally after
several product transactions have been entered.
The actions, and conditions in this macro are set up to execute in the
following order:
1.) OpenForm - To open another form where the warehouse transactions for
each product is calculated, and displayed for any one Product ID that is
selected in the second form's combo box.
2.) SetValue - To match Product IDs
3.) GoToControl - Where the balance in inventory is calculated for the product
4.) MsgBox - Displays the warning message if the condition of the calculated
inventory balance in the control is <=0
5.) CloseForm - Closes the second form if the condition of the calculated
inventory balance in the control is < 0
Is there any way to slow or pause the macro's execution until the calculated
control has time to "refresh"?
Thanks,
RC
 
S

Steve Schapel

RC,

It would be better to use a Query to return the inventory balance for
the product, rather than referencing a calculated control on a form.
Either that, or possibly a DSum() function in the macro Condition. I
would forget the form altogether.
 

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