Display all with DOB within a week

kriscs

New member
Local time
Today, 00:07
Joined
Oct 2, 2006
Messages
9
Hi, I am doing a project at school and need to run a query that displays everyone that has a date of birth within 7 days using a date in the format 01/01/2001. I really have no idea how to do this and would really appreciate any help.
Thank you very much
Kris
 
Look up DateAdd() in help to learn how to add (or subtract) days from your date. Then use this in you query to create a BETWEEN criterion for your DOB field.
 
nic and easy this one
on a form have a from and to text box in date format
and on this the text field should be formated to dd/mm/yyyy or USA style mm/dd/yyyy and repeat for from and to text
now make a qry
select your table say "Birthdaytbl"
>=[Forms]![formname]![FromDate] And <=[Forms]![formname]![ToDate]
form name will equal the anme of the form and Fromdate will be the first date you enter and to date will be the end date
if you need to enter just 1 date and have it 7 days either side tweak the code above to = forms!fornname![fromdate]-7 and forms!fornname![fromdate]+7
this may get fussy so I would have onth e form for easy 3 date field
main date 01/01/01
and 2 hidden fields and they would equal after update = maindate -7 days and the other one maindate+7 days and run the qry fromth ese hidden field names - this would give you the flexibility if you are asked to change the date to 09/09/01 it should then pick up 02/09/01 to 16/09/01 (I'm using UK date format ) but same principle applies to US format you just need to tweak the formating a bit
hope this helps
 

Users who are viewing this thread

Back
Top Bottom