How do I flag up a record that is six months old?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am writing a database for a garage. I need to produce a report that shows
when a service is due, six months after a service date.
 
In the query criteria add to the sevice date 6 months and check if it's
smaller then the current date

Select * From TableName
Where DateAdd("m",6,[service date]) < Date()
 
Before you even /think/ about writing your forms & reports, you should
design your table structure to record the information accurately. You
do not do this on the basis of how you want the forms & reports to
look. Instead, you do it to reflect the actual nature & relationships
of the data that you have to store.

I suggest that before you go any further, you show us the tables that
you intend to create, and the names of the fields in each table (the
types & lengths don't matter here). Also, clearly show the primary key
field(s) for each table. If you don't know what a "primary key" is, you
need to do some reading on the topic of "database normalization",
before you go any further!

HTH,
TC [MVP Access]
 
TC said:
Before you even /think/ about writing your forms & reports, you should
design your table structure to record the information accurately. You
do not do this on the basis of how you want the forms & reports to
look. Instead, you do it to reflect the actual nature & relationships
of the data that you have to store.

I suggest that before you go any further, you show us the tables that
you intend to create, and the names of the fields in each table (the
types & lengths don't matter here). Also, clearly show the primary key
field(s) for each table. If you don't know what a "primary key" is,
you need to do some reading on the topic of "database normalization",
before you go any further!

HTH,
TC [MVP Access]

TC is offering some very good advice. You really need to make sure you
have the foundation correct before you start building. In Access this saves
a great deal of pain later on.
 
In response to TC, Database fields are:-

Name Text
Address Text
Telephone Text
Make Text
Model Text
Chasis No. Text
Work Done Text
Date ShortDate
 
In response to TC, Database fields are:-

Name Text
Address Text
Telephone Text
Make Text
Model Text
Chasis No. Text
Work Done Text
Date ShortDate

Well... that means you must either reenter the name, address, etc.
every time a person brings in their car, or else lose the history of
previous services on the car.

I'd suggest that you use (at least) three tables:

Customers
CustomerID
LastName
FirstName
Address
Telephone

Vehicles
VIN <or an autonumber VehicleID>
Make
Model
ChassisNo
CustomerID <link to who owns it>
<other info about the vehicle>

Services
VIN <link to Vehicles>
ServiceDate <don't use Date as a fieldname>
WorkDone


You may also want to have a table of standard services - LOF,
alignment, etc. etc. - linked to the Services table, so you don't have
to retype (and misspell, all too often!) the names of the services.

John W. Vinson[MVP]
 
Picky point, but it's probably better to use

Select * From TableName
Where [service date] < DateAdd("m",-6,Date())

Access is smart enough to realize that DateAdd only needs to be run once in
the query above, while it would have to be run for each row in the table in
the query below.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Ofer said:
In the query criteria add to the sevice date 6 months and check if it's
smaller then the current date

Select * From TableName
Where DateAdd("m",6,[service date]) < Date()

--
Please respond to the group if your question been answered or not, so other
can refer to it.
Thank you and Good luck



Crusher said:
I am writing a database for a garage. I need to produce a report that shows
when a service is due, six months after a service date.
 
Good point, thanks



Douglas J Steele said:
Picky point, but it's probably better to use

Select * From TableName
Where [service date] < DateAdd("m",-6,Date())

Access is smart enough to realize that DateAdd only needs to be run once in
the query above, while it would have to be run for each row in the table in
the query below.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Ofer said:
In the query criteria add to the sevice date 6 months and check if it's
smaller then the current date

Select * From TableName
Where DateAdd("m",6,[service date]) < Date()

--
Please respond to the group if your question been answered or not, so other
can refer to it.
Thank you and Good luck



Crusher said:
I am writing a database for a garage. I need to produce a report that shows
when a service is due, six months after a service date.
 
Thankyou all very much for your help and advice. This works fine.

Ofer said:
In the query criteria add to the sevice date 6 months and check if it's
smaller then the current date

Select * From TableName
Where DateAdd("m",6,[service date]) < Date()

--
Please respond to the group if your question been answered or not, so other
can refer to it.
Thank you and Good luck



Crusher said:
I am writing a database for a garage. I need to produce a report that shows
when a service is due, six months after a service date.
 
Thanks Steve :-)

I'll have a website up soon with some personal info.

Looking forward to meeting you all in the mvp newsgroups!

Cheers,
TC [MVP Access]
 
Thanks Douglas :-)

Looking forward to meeting you all in the mvp newsgroups.

TC [MVP Access]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top