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

Locking Date Fields

Status
Not open for further replies.

shwin

Programmer
Jun 10, 2004
15
US
Hi Everyone,

I am new to Access and am running into a few problems with my database. On my form, I have three date fields (DateAgreed, DateRevised, DateClosed). The dates are entered using the pop-up calendar feature. My question is regarding how to lock this data once it is selected and saved.
The DateAgreed and DateClosed should lock as soon as the user saves the data.
The DateRevised field should lock after this date has passed

The other thing is that for the DateClosed, I only want to let the user selected a date within the past 14 days.

Any help would be greatly appreciated. Thanks a lot!
 
"The DateAgreed and DateClosed should lock as soon as the user saves the data."

In the OnCurrent Event of the Form

If IsNull(DateAgreed) Then
dateAgreed.Locked = False
Else
DateAgreed.Locked = True
End If

similar for DateClosed

"The DateRevised field should lock after this date has passed"

If IsNull(DateREvised) Then
dateRevised.locked = false
else
If DateRevised > Date() Then
dateRevised.locked = true
else
dateREvised.locked = false
end if

"The other thing is that for the DateClosed, I only want to let the user selected a date within the past 14 days."

In the Validation Property of the form control put > Date()-14 And <= date()



Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top