how can I stop a record being changed after it is changed to a certain value

DazHAT

Registered User.
Local time
Today, 02:44
Joined
Feb 8, 2007
Messages
12
how can I stop a record being changed after it is changed to a cirtain value?

my senario is this:

a shop has an order table one of the fields is status.

the status can be [order recived] or [awaiting delivery].

I have code that updates the amount in stock when the field is changed to order recived.

how do I stop the user repeatedly changing the field to order recived by mistake (and therby increasing the nuber in stock)? Is ther an easy way to do this in the Private Sub Status_Change()
???
 
You could add code to the 'Before Update' event that looks to see what the original status is and refuses any updates if it's already set to Order Received.
 
I have tried it but it will run the code nomatter which option the status fiekld is set to.

If [status] = "order recived" then
etc etc

but it runs even if the status is set back to awaiting delivery
 
What code do you have behind the BeforeUpdate event of the field in question?
 
If [status] = "order recived" then
msgbox("error")
exit sub
else
end if

end sub
 
you need a cancel=true in there after the message box
 

Users who are viewing this thread

Back
Top Bottom