Help with Date requirement

  • Thread starter Thread starter Tom Lewis
  • Start date Start date
T

Tom Lewis

How do I make a field required only on Wednesdays. There is a date field on
the form already. Thanks
 
Tom Lewis said:
How do I make a field required only on Wednesdays. There is a date field on
the form already. Thanks

In the form's BeforeUpdate event...

If Weekday(Date()) = 4 _
And IsNull([YourDateField]) Then
MsgBox "Date entry required on Wednesdays"
Cancel = True
End If
 
It might be just as simple to just automatically fill in the date on
Wednesdays, if the user doesn't do so.

If Weekday(Date()) = 4 And IsNull(Me.YourDateField) Then
Me.YourDateField = Date()
End If

Then there is the question of whether or not the user should be able to
enter a date on other days besides Wednesday. In that case the following
could be added to the Current event of the form.

If Weekday(Date()) <> 4 then
Me.YourDateField.Enabled = False
Else
Me.YourDateField.Enabled = True
End If

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm



Rick Brandt said:
Tom Lewis said:
How do I make a field required only on Wednesdays. There is a date field on
the form already. Thanks

In the form's BeforeUpdate event...

If Weekday(Date()) = 4 _
And IsNull([YourDateField]) Then
MsgBox "Date entry required on Wednesdays"
Cancel = True
End If
 
Back
Top