DateSerial

S

Stefan

I need to produce a query that will search a date range relative to a billing
date.

Basically this is for medical billing. I am trying to return whether a
procedure has been done within a 30 day period of itself.

If a procedure is performed on 10/15/08 I need to be able to filter the date
range to 10/14/08 and 30 days previous.

I am guessing the DateSerial function would be the best approach.

Can anybody help with the syntax or a better approach to this query

Thanks in advance

Stefan
 
F

fredg

I need to produce a query that will search a date range relative to a billing
date.

Basically this is for medical billing. I am trying to return whether a
procedure has been done within a 30 day period of itself.

If a procedure is performed on 10/15/08 I need to be able to filter the date
range to 10/14/08 and 30 days previous.

I am guessing the DateSerial function would be the best approach.

Can anybody help with the syntax or a better approach to this query

Thanks in advance

Stefan

You wish to return records from within 30 days or the procedure date?

In your query, write, as criteria in the [ProcedureDate] column:

Between [ProcedureDate] and DateAdd("d",-30,[ProcedureDate])

or you can use:
Between [ProcedureDate] and [ProcedureDate] - 30
 
S

Stefan

fredg said:
I need to produce a query that will search a date range relative to a billing
date.

Basically this is for medical billing. I am trying to return whether a
procedure has been done within a 30 day period of itself.

If a procedure is performed on 10/15/08 I need to be able to filter the date
range to 10/14/08 and 30 days previous.

I am guessing the DateSerial function would be the best approach.

Can anybody help with the syntax or a better approach to this query

Thanks in advance

Stefan

You wish to return records from within 30 days or the procedure date?

In your query, write, as criteria in the [ProcedureDate] column:

Between [ProcedureDate] and DateAdd("d",-30,[ProcedureDate])

or you can use:
Between [ProcedureDate] and [ProcedureDate] - 30

Would I use Between [ProcedureDate] - 1 and [ProcedureDate] -30
Since I do not want to include the date of the current procedure

Thanks
 
F

fredg

fredg said:
I need to produce a query that will search a date range relative to a billing
date.

Basically this is for medical billing. I am trying to return whether a
procedure has been done within a 30 day period of itself.

If a procedure is performed on 10/15/08 I need to be able to filter the date
range to 10/14/08 and 30 days previous.

I am guessing the DateSerial function would be the best approach.

Can anybody help with the syntax or a better approach to this query

Thanks in advance

Stefan

You wish to return records from within 30 days or the procedure date?

In your query, write, as criteria in the [ProcedureDate] column:

Between [ProcedureDate] and DateAdd("d",-30,[ProcedureDate])

or you can use:
Between [ProcedureDate] and [ProcedureDate] - 30

Would I use Between [ProcedureDate] - 1 and [ProcedureDate] -30
Since I do not want to include the date of the current procedure

Thanks

Yes.
 
J

John Spencer

If you are doing this to identify over all records. I think you may want a
query that is something like the following.

SELECT A.PatientID, A.ProcedureCode, A.ProcedureDate, B.ProcedureDate
FROM Procedures as A INNER JOIN Procedures as B
ON A.PatientID = B.PatientID
AND A.ProcedureCode = B.ProcedureCode
WHERE B.ProcedureDate BETWEEN A.ProcedureDate-30 and A.ProcedureDate-1

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
 

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

Top