Quick MS Access / VBasic question on dates...
#1
Quick MS Access / VBasic question on dates...
Each record in my table has a date in it
I want a query that will only list records with a date field of less than a month ago (from today)
I know today's date in Access is date() , so I need some way in code to say date() minus 30 days eg.
Dim mydate
mydate = date() - 30
Any ideas ?
I want a query that will only list records with a date field of less than a month ago (from today)
I know today's date in Access is date() , so I need some way in code to say date() minus 30 days eg.
Dim mydate
mydate = date() - 30
Any ideas ?
#2
Scooby Regular
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like
on
1 Post
DateAdd(d, -30, Date())
Should return the date 30 days ago..
or
DateAdd(m,-1,Date())
should do 1 month ago
I havent checked the syntax as Im off for a pint, but should give you a start.
edited to add...
David
Should return the date 30 days ago..
or
DateAdd(m,-1,Date())
should do 1 month ago
I havent checked the syntax as Im off for a pint, but should give you a start.
edited to add...
Code:
Dim MyDate MyDate = DateAdd(d, -30, Date())
Thread
Thread Starter
Forum
Replies
Last Post
Brzoza
Engine Management and ECU Remapping
1
02 October 2015 05:26 PM