Age Restricted Orders vs Dates Of Birth

  • Thread starter Thread starter SteveH
  • Start date Start date
S

SteveH

Guest
Hi,

I'm looking for some help in my queries concerning date of births.

I'm making a database which stores information about customer orders for a shop. Some of these orders are videos and dvds etc with age restrictions. How do I use sql to distinguish whether the customer's Date Of Birth (customer table holds fields such as Name, Address DOB etc) makes that person 18years or older?

Ive come up with an alternative at the moment using which i don't like:

WHERE (((tblCustomer.[Date Of Birth])>=[Date Of Birth Needed To Be 18]));

This method is annoying as the member of staff will have to think about the DOB needed for the customer to be 18 and could easily put it in wrong.

How do I make the set date move with current date?

I would be real grateful if theres anybody who could help me at all.

Thanks


Steve


PS

How would I make my database do certain procedures at given times in the day?(i.e save itself, perform certain queries to check that no orders of 18 certificate videos have been ordered to under 18s etc)

Thanx
 
Use the following function to calculate the age from the date of birth:

Public Function fGetAge(DOB As Variant) As Integer
If Not IsDate(DOB) Then Exit Function
fGetAge = DateDiff("yyyy", DOB, Date) + (Date < DateSerial(Year(Date), Month(DOB), Day(DOB)))
End Function

HTH
RDH

[This message has been edited by R. Hicks (edited 01-02-2002).]
 

Users who are viewing this thread

Back
Top Bottom