criteria to see only last four records

W

wen22222

I have an access question for anyone who can help. Do you know if there is a
criteria that can be entered to select the last four records of a patient,
without inserting any type of date??? Therefore if I have a patient that was
seen 6 times but I only want the last four dates to show up how would I do
that????

Thank you.
 
F

fredg

I have an access question for anyone who can help. Do you know if there is a
criteria that can be entered to select the last four records of a patient,
without inserting any type of date??? Therefore if I have a patient that was
seen 6 times but I only want the last four dates to show up how would I do
that????

Thank you.

In a query? .....

SELECT TOP 4 tblRecords.*
FROM tblRecords
WHERE tblRecords.PatientID= [Enter PatientID]
ORDER BY tblRecords.VisitDate DESC;

The above assumes the PatiendID is a Unique value, Number datatype.
You will be prompted to enter the wanted patient's ID.
Also change the table and field names as needed.
 
W

wen22222

Hello and thank you for the responses. I will be so happy to figure this
out! I do want to be able to pull out the last four patient records in a
query, but I am not sure where I would enter the stuff you included in your
response.

Thanks so much.

Wendy


fredg said:
I have an access question for anyone who can help. Do you know if there is a
criteria that can be entered to select the last four records of a patient,
without inserting any type of date??? Therefore if I have a patient that was
seen 6 times but I only want the last four dates to show up how would I do
that????

Thank you.

In a query? .....

SELECT TOP 4 tblRecords.*
FROM tblRecords
WHERE tblRecords.PatientID= [Enter PatientID]
ORDER BY tblRecords.VisitDate DESC;

The above assumes the PatiendID is a Unique value, Number datatype.
You will be prompted to enter the wanted patient's ID.
Also change the table and field names as needed.
 
F

fredg

Hello and thank you for the responses. I will be so happy to figure this
out! I do want to be able to pull out the last four patient records in a
query, but I am not sure where I would enter the stuff you included in your
response.

Thanks so much.

Wendy

fredg said:
I have an access question for anyone who can help. Do you know if there is a
criteria that can be entered to select the last four records of a patient,
without inserting any type of date??? Therefore if I have a patient that was
seen 6 times but I only want the last four dates to show up how would I do
that????

Thank you.

In a query? .....

SELECT TOP 4 tblRecords.*
FROM tblRecords
WHERE tblRecords.PatientID= [Enter PatientID]
ORDER BY tblRecords.VisitDate DESC;

The above assumes the PatiendID is a Unique value, Number datatype.
You will be prompted to enter the wanted patient's ID.
Also change the table and field names as needed.


Copy the code I gave you in my previous reply.
Create a new query.

While in Query Design view, click on View + SQL.

Paste the code you copied over whatever is already written.
Change the Table Name and field Names to whatever table and field
names you are actually using.
Click on the ! symbol.

When prompted, enter the ID number of the person whose records you
wish to show.

If the data is correct, save the query.
 
W

wen22222

THANK YOU VERY, VERY MUCH -- I FIGURED IT OUT WITH YOUR DIRECTIONS!!!!

fredg said:
Hello and thank you for the responses. I will be so happy to figure this
out! I do want to be able to pull out the last four patient records in a
query, but I am not sure where I would enter the stuff you included in your
response.

Thanks so much.

Wendy

fredg said:
On Tue, 14 Aug 2007 06:34:01 -0700, wen22222 wrote:

I have an access question for anyone who can help. Do you know if there is a
criteria that can be entered to select the last four records of a patient,
without inserting any type of date??? Therefore if I have a patient that was
seen 6 times but I only want the last four dates to show up how would I do
that????

Thank you.

In a query? .....

SELECT TOP 4 tblRecords.*
FROM tblRecords
WHERE tblRecords.PatientID= [Enter PatientID]
ORDER BY tblRecords.VisitDate DESC;

The above assumes the PatiendID is a Unique value, Number datatype.
You will be prompted to enter the wanted patient's ID.
Also change the table and field names as needed.


Copy the code I gave you in my previous reply.
Create a new query.

While in Query Design view, click on View + SQL.

Paste the code you copied over whatever is already written.
Change the Table Name and field Names to whatever table and field
names you are actually using.
Click on the ! symbol.

When prompted, enter the ID number of the person whose records you
wish to show.

If the data is correct, save the query.
 
Top