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

Forms, Locking records

Status
Not open for further replies.

blackte

Programmer
Jul 24, 2001
80
US
I have a form that queries a table that contains a date stamp, and I would like to lock those records that are older than the current date from being updated on the form. Is there a way in the query to do this, or should this be done on the form itself, and how can it be done. Thanks in advance for the help with this.
 
in the design of your application give the user two options one to just add a new record and one to just search old records. when they search old records, the date will be older than the current date, so just lock the fields on that form. if they choose to add a record bring up a blank form with the current date as a default. that way you will avoid users edit info that is older than the current date. You may need to copy your form and give it two different names one for adding records and one for searching. hope this helps or gives you some ideas
 
Another idea would be to put some code in the on_current event of your form. If me!date < current date then lock or disable the text boxes, otherwise unlock and enable them.
 
I can lock each field on the form via the &quot;on current&quot; procedure, but is there anyway to lock the entire form without coding each field. Thanks Travis
 
What about setting the AllowEddits property of the form? Put something like this in the OnCurrent event:

If Me!MyDate < Date() - 60
Me!Customers.AllowEdits = False
Else
Me!Customers.AllowEdits = True
End If
Terry M. Hoey
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top