Good Morning!
Access 2010
I am trying to create a query whereby I display a numeric value which represents the number of days between 2 dates of consecutive records where the record ID is the same (That makes sense in my head!!)
I have a table called tblJobs where the key field is JobNo and the date field to compare is Job_Start.
I have also added the table again to the query so have an identical data source called tblJobs_1 as I believe this is the way to compare records.
Assuming the following dummy data:
JobNo, Job_Start
10000, 31/12/2010
10001, 31/12/2010
10001, 10/12/2010
10002, 01/11/2010
10003, 30/11/2010
10003, 20/11/2010
I want to acheve the following result by creating a 'field' criteria where the field will be name Visit_Gap:
JobNo, Job_Start, Visit_Gap
10000, 31/12/2010, 99
10001, 31/12/2010, 99
10001, 10/12/2010, 21
10002, 01/11/2010, 99
10003, 30/11/2010, 99
10003, 20/11/2010, 10
If the previous record isn't the same JobNo or its the first record in the table, default to 99
I'm having a mare with this...can anyone offer any assistance....please?
Many thanks in advance
Steve
Access 2010
I am trying to create a query whereby I display a numeric value which represents the number of days between 2 dates of consecutive records where the record ID is the same (That makes sense in my head!!)
I have a table called tblJobs where the key field is JobNo and the date field to compare is Job_Start.
I have also added the table again to the query so have an identical data source called tblJobs_1 as I believe this is the way to compare records.
Assuming the following dummy data:
JobNo, Job_Start
10000, 31/12/2010
10001, 31/12/2010
10001, 10/12/2010
10002, 01/11/2010
10003, 30/11/2010
10003, 20/11/2010
I want to acheve the following result by creating a 'field' criteria where the field will be name Visit_Gap:
JobNo, Job_Start, Visit_Gap
10000, 31/12/2010, 99
10001, 31/12/2010, 99
10001, 10/12/2010, 21
10002, 01/11/2010, 99
10003, 30/11/2010, 99
10003, 20/11/2010, 10
If the previous record isn't the same JobNo or its the first record in the table, default to 99
I'm having a mare with this...can anyone offer any assistance....please?
Many thanks in advance
Steve