MS Access sql query...
 

MegaSack DRAW - 6pm Christmas Eve - LIVE on our YouTube Channel

[Closed] MS Access sql query help

2 Posts
3 Users
0 Reactions
69 Views
Posts: 0
Free Member
Topic starter
 

Hi all

I a creating a query the gets an [entered date] - 7 days then - 14 days then - 21 days etc...

i have this
[code]
FORMAT(Appointments.[18 Week Start Date], "DD-7/MM/YYYY")
FORMAT(Appointments.[18 Week Start Date], "DD-14/MM/YYYY")
FORMAT(Appointments.[18 Week Start Date], "DD-21/MM/YYYY")
[/code]

The problem is that when i get to 14 and 21 the amounts are the same 🙁

Please help

Cheers,
Neil


 
Posted : 03/06/2009 10:08 am
Posts: 621
Free Member
 

been a while since I did any work with Access, but wouldn't it be better to call dateadd() ?

http://www.techonthenet.com/access/functions/date/dateadd.php

Can't remember if it purely a VBA function or if they implement it as part of their SQL processing. If it is a callback to the VBA function the SQL query might run a tad slowly...(each row will have to be fetched then processed client side)


 
Posted : 03/06/2009 10:22 am
Posts: 0
Free Member
 

A fellow NHS worker no doubt?
try:

[code]
FORMAT(Appointments.[18 Week Start Date]-7, "DD/MM/YYYY")
FORMAT(Appointments.[18 Week Start Date]-14, "DD/MM/YYYY")
FORMAT(Appointments.[18 Week Start Date]-21, "DD/MM/YYYY")
[/code]

As long as the Appointments.[18 Week Start Date] is a date field you should be sorted


 
Posted : 03/06/2009 1:49 pm