Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DateDiff between "short date" and "number"

Status
Not open for further replies.

bc1234

Technical User
Aug 12, 2001
3
US
Hi Friends,

I am working on some questionnaires for patients to see if they quality for a Study. First I will type in the "admit_date" from some resources. The "admit_date" is the date that a patient was admitted to the hospital. Then I need to find out from the patient: When did pain develop before this admit_date? If pain happened 2 weeks prior to admit_date, then patient is eligible.

Question:
Is it possible to do a DateDiff when one field is "short date" and the others are "number"? Or what should I do? Example:

Field1 = admit_date (format is short date)
Field2 = month (don't know what should be the format? number?)
Field3 = year (format is unknown)

Field2 and Field3 do not have room for "date". It is because very little people remembered the exact date. They usually remember the month and year only; unless the admit_date was very recent. If say, admit_date = 8/28/2000, then (month needs to be > 0.5 of admit_date), And (year needs to be 2000 or before) then Msgbox("Eligible").
How can I write this code?

Or another possibility is if I can leave "date" blank when Field2 format="short date"? How? Date will be wrong when it is blank. Access will automatically input the first day of the month.

Thanks,
Beanie
 
You Can try doing something like this

Field1Month = Month(Admit_Date) 'This will Give you The Month only of the Admit_Date
Field1Year = Year(Admit_Date) 'SAA except it'll only give the Year
Field2 = Month Pain Started
Field3 = Year Pain Started

Year(s)SincePainStarted = Field1Year - Field3
Month(s)SincePainStarted = Field1Month - Field2

from there you can perform if...then statements or case select what ever your more comfortable with.

HTH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top