Hi experts,
I have an Access table that hold the patient's info including AdmDate and DisChrgDate. I'm using VB front end to populate the data. I want to run a report showing all patients that return within 30days from the day they discharged. Right now what i'm doing is loop through each record for each patient and determine if the admdate is within the 30 days of the previous dischrgdate. If it is, I'll print that record out. Doing this way in vb is slow. Is there a way that this can be done via a query? Below is example of the table:
UserID AdmDate DisChrgDate Reason ...
1 1/1/13 1/2/13 Cold ...
2 1/1/13 1/1/13 Flu ...
3 1/1/13 1/3/13 Cough ...
1 1/4/13 1/4/13 Cough ...
2 2/2/13 2/3/13 .....
3 1/28/13 2/4/13 ....
2 2/7/13 2/19/13 .....
The results from the example above would be:
UserID AdmDate DisChrgDate Reason ....
1 1/1/13 1/2/13 Cold ...
1 1/4/13 1/4/13 Cough ...
2 2/2/13 2/3/13 .....
2 2/7/13 2/19/13 .....
3 1/1/13 1/3/13 Cough ...
3 1/28/13 2/4/13 ....
Thanks!
I have an Access table that hold the patient's info including AdmDate and DisChrgDate. I'm using VB front end to populate the data. I want to run a report showing all patients that return within 30days from the day they discharged. Right now what i'm doing is loop through each record for each patient and determine if the admdate is within the 30 days of the previous dischrgdate. If it is, I'll print that record out. Doing this way in vb is slow. Is there a way that this can be done via a query? Below is example of the table:
UserID AdmDate DisChrgDate Reason ...
1 1/1/13 1/2/13 Cold ...
2 1/1/13 1/1/13 Flu ...
3 1/1/13 1/3/13 Cough ...
1 1/4/13 1/4/13 Cough ...
2 2/2/13 2/3/13 .....
3 1/28/13 2/4/13 ....
2 2/7/13 2/19/13 .....
The results from the example above would be:
UserID AdmDate DisChrgDate Reason ....
1 1/1/13 1/2/13 Cold ...
1 1/4/13 1/4/13 Cough ...
2 2/2/13 2/3/13 .....
2 2/7/13 2/19/13 .....
3 1/1/13 1/3/13 Cough ...
3 1/28/13 2/4/13 ....
Thanks!