Enabling & Disabling Child windows (1 Viewer)

RadioProject

New member
Local time
Today, 17:42
Joined
Dec 16, 1999
Messages
5
I have a table that involves a tick box with an associated date field. I want to be able to enable the date field when the tick box field is set to TRUE. Also, when the date field is enabled I need to place the system date plus 30 days into it as a default value.

Also, if it is possible, can the tick box be set to FALSE when the system date equals the date in the date field? (ie the tick box stays TRUE until the date specified)
 

Travis

Registered User.
Local time
Today, 10:42
Joined
Dec 17, 1999
Messages
1,332
Try this,

1. On the AfterUpdate Event of the Tick Box add this code.

Private Sub TickBox_AfterUpdate()
Me.DateField.Enabled=Me.TickBox
Select Case Me.TickBox
Case True
Me.DateField= DateAdd("d",30,Date)
Case False
Me.DateField = Empty
End Select
End Sub

2. Add this code to the Form_Current Event of the Form.

Private Sub Form_Current()
If Me.DateField=Date then Me.TickBox=False
End Sub

Note: For the DateAdd Function here is a list of the variables possible.

yyyy Year
q Quarter
m Month
y Day of year
d Day
w Weekday
ww Week
h Hour
n Minute
s Second
 

Users who are viewing this thread

Top Bottom