Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

ACCESS HELP PLEASE

Thread Tools
 
Search this Thread
 
Old 20 March 2002, 04:24 PM
  #1  
Vinesh
Scooby Regular
Thread Starter
 
Vinesh's Avatar
 
Join Date: Jul 2001
Posts: 1,795
Likes: 0
Received 0 Likes on 0 Posts
Question

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.
Old 20 March 2002, 04:42 PM
  #2  
Martingb
Scooby Regular
 
Martingb's Avatar
 
Join Date: Oct 2001
Posts: 65
Likes: 0
Received 0 Likes on 0 Posts
Post

Vinesh

Use the DATEADD function.

e.g. DATEADD("D", -7, <date&gt

Use a msgbox to prompt the user.

Martin.
Old 20 March 2002, 04:44 PM
  #3  
Vinesh
Scooby Regular
Thread Starter
 
Vinesh's Avatar
 
Join Date: Jul 2001
Posts: 1,795
Likes: 0
Received 0 Likes on 0 Posts
Post

Cheers mate.
Old 20 March 2002, 04:48 PM
  #4  
Vinesh
Scooby Regular
Thread Starter
 
Vinesh's Avatar
 
Join Date: Jul 2001
Posts: 1,795
Likes: 0
Received 0 Likes on 0 Posts
Post

Where would I enter the DATEADD function? Do I go to the property of the field, then in the data tab, then default value?
Old 21 March 2002, 11:26 AM
  #5  
NumptyScrub
Scooby Regular
 
NumptyScrub's Avatar
 
Join Date: Sep 2001
Posts: 112
Likes: 0
Received 0 Likes on 0 Posts
Post

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]
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
JimBowen
ICE
5
02 July 2023 01:54 PM
TylerD529
General Technical
2
09 October 2015 01:53 AM
Littleted
Computer & Technology Related
4
25 September 2015 09:55 PM
Hangarrat93
Insurance
11
25 September 2015 08:42 AM
farmerwrx
Computer & Technology Related
14
10 September 2015 11:59 AM



Quick Reply: ACCESS HELP PLEASE



All times are GMT +1. The time now is 05:25 AM.