• ** There has been a recent site upgrade. Please clear your browser cache to avoid issues. **
  • New forum feature - post voting and best solution

    Check out this thread for the details: https://www.access-programmers.co.uk/forums/threads/new-forum-feature-post-voting-and-best-answer.314134/

    This new feature looks great to me! :)

  • We now have 3 forum themes

    Go for the default (light) theme, Shades of Grey or Shades of Blue. I just added the Blue one.

    The thread about it is here: https://www.access-programmers.co.uk/forums/threads/new-forum-theme-shades-of-blue.314136/

Enabling & Disabling Child windows (1 Viewer)

RadioProject

New member
Local time
Today, 01:54
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
Yesterday, 17:54
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