Lock record

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to be able to lock a record based on a condition. For example I have a
field called "Ordered" that tells me if the item has been ordered or not. I
want to prevent users from modifying this record if this field has a value
(date). I am trying to use the allow property for the form, but I can still
modify it.
Any ideas?
Thx,
 
In the Current event of the form, change the allow property. The Current
event runs each time you move to a different record. You would have it check
the value in the mentioned field and change the form's allow property if a
date is detected.

Example:
Me.AllowEdits = Not IsDate(Me!Ordered)

The IsDate function will return True or False, depending on whether or not
the value of the field is a date. The Not will reverse this, so if a date is
found (True) then the Not will reverse this to make AllowEdits be False. If
a date isn't found, then AllowEdits will be True.

IsDate doesn't care what format the date is in. As long as it thinks it can
convert what is in the field to a valid date, the result will be True.

This could also be done with an If, Then, Else statement. You may need to do
this for AllowDeletions as well.
 

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

Back
Top