ACCESS HELP PLEASE
#1
Quick question for all u Access Wizards.
How do I make a form prompt me of a expiry date, ie 7 days before it expires?
OR
Date = 20/3/02
How would I make the form prompt me 7 days before, on 13/3/02?
Cheers.
How do I make a form prompt me of a expiry date, ie 7 days before it expires?
OR
Date = 20/3/02
How would I make the form prompt me 7 days before, on 13/3/02?
Cheers.
#5
If it's a data display form, then use the forms OnCurrent event.
This fires every time the record is changed on the form, so you could use IsNull to check whether the date holds a value, then check the date against todays date.
ie
Private Sub Form_OnCurrent()
If Not IsNull(Form!Date_To_Check) Then
If (Form!Date_To_Check>=Now()) And (Form!Date_To_Check<(Now()+7)) Then
Msgbox "Less than 7 days to go",vbOkOnly,"Date Check"
End If
End If
End Sub
(I hold no responsibility for typo's in this example, I didn't cut and paste it )
<edit> the spaces haven't come through, hope the code is still readable </edit>
Date/time fields are held as floating point no's (IEEE date spec), with the integer part as the day and the decimal part as the time (ie 0.5 is midday). So to add or subtract a number of days, just add or subtract that number direct (it's easier, trust me ).
Derek
[Edited by NumptyScrub - 3/21/2002 11:28:26 AM]
[Edited by NumptyScrub - 3/21/2002 11:31:59 AM]
This fires every time the record is changed on the form, so you could use IsNull to check whether the date holds a value, then check the date against todays date.
ie
Private Sub Form_OnCurrent()
If Not IsNull(Form!Date_To_Check) Then
If (Form!Date_To_Check>=Now()) And (Form!Date_To_Check<(Now()+7)) Then
Msgbox "Less than 7 days to go",vbOkOnly,"Date Check"
End If
End If
End Sub
(I hold no responsibility for typo's in this example, I didn't cut and paste it )
<edit> the spaces haven't come through, hope the code is still readable </edit>
Date/time fields are held as floating point no's (IEEE date spec), with the integer part as the day and the decimal part as the time (ie 0.5 is midday). So to add or subtract a number of days, just add or subtract that number direct (it's easier, trust me ).
Derek
[Edited by NumptyScrub - 3/21/2002 11:28:26 AM]
[Edited by NumptyScrub - 3/21/2002 11:31:59 AM]
Thread
Thread Starter
Forum
Replies
Last Post