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.

Quick MS Access / VBasic question on dates...

Thread Tools
 
Search this Thread
 
Old 13 May 2006, 03:56 PM
  #1  
spectrum48k
Scooby Regular
Thread Starter
 
spectrum48k's Avatar
 
Join Date: Feb 2006
Posts: 2,519
Likes: 0
Received 0 Likes on 0 Posts
Default 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 ?
Old 13 May 2006, 04:19 PM
  #2  
David_Wallis
Scooby Regular
 
David_Wallis's Avatar
 
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
Default

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...

Code:
Dim MyDate
MyDate = DateAdd(d, -30, Date())
David
Old 13 May 2006, 06:06 PM
  #3  
spectrum48k
Scooby Regular
Thread Starter
 
spectrum48k's Avatar
 
Join Date: Feb 2006
Posts: 2,519
Likes: 0
Received 0 Likes on 0 Posts
Default

lovely - cheers
Old 13 May 2006, 11:47 PM
  #4  
David_Wallis
Scooby Regular
 
David_Wallis's Avatar
 
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
Default

No prob.
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
JimBowen
ICE
5
02 July 2023 01:54 PM
KAS35RSTI
Subaru
27
04 November 2021 07:12 PM
TylerD529
General Technical
2
09 October 2015 01:53 AM
IanG1983
Wheels, Tyres & Brakes
2
06 October 2015 03:08 PM
Brzoza
Engine Management and ECU Remapping
1
02 October 2015 05:26 PM



Quick Reply: Quick MS Access / VBasic question on dates...



All times are GMT +1. The time now is 07:19 AM.