Lock Calendar

L

Lori

I have a calendar form that our employees are using to enter in vacation
days, sick days, etc. My question hopefully has a simple answer.

How do I prevent a user from changing information on a past date? They
should be able to edit future dates where they may have scheduled a day off
but not dates that have already passed.

Any help would be appreciated.
 
L

Linq Adams via AccessMonster.com

Where DateTextBox is the control holding the date that has been entered.

Private Sub Form_Current()
If Me.DateTextBox < Date Then
Me.DateTextBox.Locked = True
Else
Me.DateTextBox.Locked = False
End If
End Sub
 
L

Lori

Ideally this should work perfect but maybe its the form.

I was sent this form to use, created by Ray Corbin as a monthly schedule
calendar.
The form is set up using unbound text boxes with =ThisIs() in the On Click
event. The code for the form includes:

Function ThisIs()
Dim TDate As Date, C1 As Integer, StrSQL As String, TypeAttend, RecDetect
C1 = 1: TDate = Me![scr1Date]
Do Until C1 = CInt(Mid(ActiveControl.Name, 3, 2))
TDate = DateAdd("d", 1, TDate)
C1 = C1 + 1
Loop

This code enters the dates for the given month. These boxes are named CC01,
CC02, etc.

Now I know I would need to put this code in for each textbox but when I
tested in on the first (CC01) the word "locked" gave me a "compile error"
"Method or Data Member not found".

Any ideas?
 

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