Add years to a date dependant on age

smally

Registered User.
Local time
Today, 18:20
Joined
Mar 29, 2005
Messages
71
Hello. I have a database that contains employee's details, and medicals they may have attended.

tblEmployees contains employee data, including date of birth.
tblMedicalRecords contains data about what the medical results were, including the date the medical occured.
attachment.php


Previously I had stored all the information on spreadsheets [see attached]

All staff will require numerous medicals, how frequent depends on thier age.
What I need to do via my database is calculate when a medical will expire.

On my spreadsheet I used a table to decide how many months to add dependant on the employee's age by VLOOKUP.
How can I achieve this in Access?

The closest I've got so far is:
Code:
SELECT tblMedicalRecords.EmployeeID, Max(DateAdd("m",60,[MedDate])) AS MedExp
FROM tblMedicalRecords
GROUP BY tblMedicalRecords.EmployeeID;
 

Attachments

  • qryMedicalExpiry.png
    qryMedicalExpiry.png
    4.7 KB · Views: 134
  • MedicalExpiryXLSX.zip
    MedicalExpiryXLSX.zip
    17.4 KB · Views: 138
  • 1toMany.png
    1toMany.png
    6.6 KB · Views: 220
I believe there's a stratification forumla in Access, but I can't find it on google. Also, I don't like putting relevant data in a function when it would be better stored in a table. So in situations like this. I make a table to define my ranges and resulting value and then use I function to put values into those ranges.

Attached is a sample database to demonstrate. Let me know if you have any questions.
 

Attachments

Users who are viewing this thread

Back
Top Bottom