Append Query clarification

M

Mark M S

I am using Access 2002. The answer might be obvious but escapes me now.

I have an Append query based on the records from a VisitID Table with the
criteria filed [VisitDate] Date()-1 and if the patient is Print "Yes". This
then adds the last visits details from the last fields completed. This works
great to bring the last record to the current day (New Record) - if the
patient is seen by someone using the database. If one day or several days
are not completed in the database then it doesn't see the day before and no
records are appended.

How would I set the criteria to use the most recent record saved rather than
the prior day record - some kind of parameter query with the last visit
date?


INSERT INTO VisitID ( Account, ProviderID, AgeInDays, AgeInHours,
Temperature, Pulse, Respirations, [Blood PressureSystolic],
BloodPressureDiastolic, Diagnositic, WeightCurrent, WeightPrevious,
HCCurent, HCPrevious, LCurrent, Cardiac, Pulmonary, Metabolism, Nutrition,
CNS, Infectious, Hematology, Bilirubin, Chemistry, Social, [Follow-up],
Medications, Narrative, ProgressNote, AdmitMD, DailyMD, DCMD, EENT, Derm,
[GI/GU], Dx1, Dx2, Dx3, Dx4, Dx5 )
SELECT PatientID.Account, VisitID.ProviderID, VisitID.AgeInDays,
VisitID.AgeInHours, VisitID.Temperature, VisitID.Pulse,
VisitID.Respirations, VisitID.[Blood PressureSystolic],
VisitID.BloodPressureDiastolic, VisitID.Diagnositic, VisitID.WeightCurrent,
VisitID.WeightPrevious, VisitID.HCCurent, VisitID.HCPrevious,
VisitID.LCurrent, VisitID.Cardiac, VisitID.Pulmonary, VisitID.Metabolism,
VisitID.Nutrition, VisitID.CNS, VisitID.Infectious, VisitID.Hematology,
VisitID.Bilirubin, VisitID.Chemistry, VisitID.Social, VisitID.[Follow-up],
VisitID.Medications, VisitID.Narrative, VisitID.ProgressNote,
VisitID.AdmitMD, VisitID.DailyMD, VisitID.DCMD, VisitID.EENT, VisitID.Derm,
VisitID.[GI/GU], VisitID.Dx1, VisitID.Dx2, VisitID.Dx3, VisitID.Dx4,
VisitID.Dx5
FROM PatientID INNER JOIN VisitID ON PatientID.Account = VisitID.Account
WHERE (((VisitID.VisitDate)=Date()-1) AND ((PatientID.Print)="yes"));
*************************************************
Mark M Simonian MD FAAP

****************************************
Alert: This email and any files transmitted with it
are intended solely for the use of the individual or
entity to whom they are addressed and may contain
confidential, patient health or other legally
privileged information. If you have received this
email in error please notify the sender by email,
delete and destroy this message and its attachments.
Any unauthorized review, use, disclosure,
or distribution is prohibited.
 
J

John Spencer

Perhaps the following SELECT query will give you the records you are looking
for. If it does, then you should be able to adapt it to your Append query.

SELECT PatientID.Account, VisitID.ProviderID, VisitID.AgeInDays,
VisitID.AgeInHours, VisitID.Temperature, VisitID.Pulse,
VisitID.Respirations, VisitID.[Blood PressureSystolic],
VisitID.BloodPressureDiastolic, VisitID.Diagnositic, VisitID.WeightCurrent,
VisitID.WeightPrevious, VisitID.HCCurent, VisitID.HCPrevious,
VisitID.LCurrent, VisitID.Cardiac, VisitID.Pulmonary, VisitID.Metabolism,
VisitID.Nutrition, VisitID.CNS, VisitID.Infectious, VisitID.Hematology,
VisitID.Bilirubin, VisitID.Chemistry, VisitID.Social, VisitID.[Follow-up],
VisitID.Medications, VisitID.Narrative, VisitID.ProgressNote,
VisitID.AdmitMD, VisitID.DailyMD, VisitID.DCMD, VisitID.EENT, VisitID.Derm,
VisitID.[GI/GU], VisitID.Dx1, VisitID.Dx2, VisitID.Dx3, VisitID.Dx4,
VisitID.Dx5
FROM PatientID INNER JOIN VisitID ON PatientID.Account = VisitID.Account
WHERE VisitID.VisitDate=(SELECT Max(Tmp.VisitDate)
FROM VisitID as Tmp
WHERE Tmp.Account =
VisitID.Account AND
Tmp.VisitDate < Date())
AND PatientID.Print="yes"


Mark M S said:
I am using Access 2002. The answer might be obvious but escapes me now.

I have an Append query based on the records from a VisitID Table with the
criteria filed [VisitDate] Date()-1 and if the patient is Print "Yes".
This then adds the last visits details from the last fields completed.
This works great to bring the last record to the current day (New
Record) - if the patient is seen by someone using the database. If one
day or several days are not completed in the database then it doesn't see
the day before and no records are appended.

How would I set the criteria to use the most recent record saved rather
than the prior day record - some kind of parameter query with the last
visit date?


INSERT INTO VisitID ( Account, ProviderID, AgeInDays, AgeInHours,
Temperature, Pulse, Respirations, [Blood PressureSystolic],
BloodPressureDiastolic, Diagnositic, WeightCurrent, WeightPrevious,
HCCurent, HCPrevious, LCurrent, Cardiac, Pulmonary, Metabolism, Nutrition,
CNS, Infectious, Hematology, Bilirubin, Chemistry, Social, [Follow-up],
Medications, Narrative, ProgressNote, AdmitMD, DailyMD, DCMD, EENT, Derm,
[GI/GU], Dx1, Dx2, Dx3, Dx4, Dx5 )
SELECT PatientID.Account, VisitID.ProviderID, VisitID.AgeInDays,
VisitID.AgeInHours, VisitID.Temperature, VisitID.Pulse,
VisitID.Respirations, VisitID.[Blood PressureSystolic],
VisitID.BloodPressureDiastolic, VisitID.Diagnositic,
VisitID.WeightCurrent, VisitID.WeightPrevious, VisitID.HCCurent,
VisitID.HCPrevious, VisitID.LCurrent, VisitID.Cardiac, VisitID.Pulmonary,
VisitID.Metabolism, VisitID.Nutrition, VisitID.CNS, VisitID.Infectious,
VisitID.Hematology, VisitID.Bilirubin, VisitID.Chemistry, VisitID.Social,
VisitID.[Follow-up], VisitID.Medications, VisitID.Narrative,
VisitID.ProgressNote, VisitID.AdmitMD, VisitID.DailyMD, VisitID.DCMD,
VisitID.EENT, VisitID.Derm, VisitID.[GI/GU], VisitID.Dx1, VisitID.Dx2,
VisitID.Dx3, VisitID.Dx4, VisitID.Dx5
FROM PatientID INNER JOIN VisitID ON PatientID.Account = VisitID.Account
WHERE (((VisitID.VisitDate)=Date()-1) AND ((PatientID.Print)="yes"));
*************************************************
Mark M Simonian MD FAAP

****************************************
Alert: This email and any files transmitted with it
are intended solely for the use of the individual or
entity to whom they are addressed and may contain
confidential, patient health or other legally
privileged information. If you have received this
email in error please notify the sender by email,
delete and destroy this message and its attachments.
Any unauthorized review, use, disclosure,
or distribution is prohibited.
 
M

Mark M S

I just queried on the query and it worked great Thanks so much

--
*************************************************
Mark M Simonian MD FAAP
Medical Director, ChildNet Medical Assoc.
681 Medical Center Drive West #106
Clovis, CA 93611
(559) 325-6850
www.markmsimonian.medem.com
****************************************
Alert: This email and any files transmitted with it
are intended solely for the use of the individual or
entity to whom they are addressed and may contain
confidential, patient health or other legally
privileged information. If you have received this
email in error please notify the sender by email,
delete and destroy this message and its attachments.
Any unauthorized review, use, disclosure,
or distribution is prohibited.
John Spencer said:
Perhaps the following SELECT query will give you the records you are
looking for. If it does, then you should be able to adapt it to your
Append query.

SELECT PatientID.Account, VisitID.ProviderID, VisitID.AgeInDays,
VisitID.AgeInHours, VisitID.Temperature, VisitID.Pulse,
VisitID.Respirations, VisitID.[Blood PressureSystolic],
VisitID.BloodPressureDiastolic, VisitID.Diagnositic,
VisitID.WeightCurrent,
VisitID.WeightPrevious, VisitID.HCCurent, VisitID.HCPrevious,
VisitID.LCurrent, VisitID.Cardiac, VisitID.Pulmonary, VisitID.Metabolism,
VisitID.Nutrition, VisitID.CNS, VisitID.Infectious, VisitID.Hematology,
VisitID.Bilirubin, VisitID.Chemistry, VisitID.Social, VisitID.[Follow-up],
VisitID.Medications, VisitID.Narrative, VisitID.ProgressNote,
VisitID.AdmitMD, VisitID.DailyMD, VisitID.DCMD, VisitID.EENT,
VisitID.Derm,
VisitID.[GI/GU], VisitID.Dx1, VisitID.Dx2, VisitID.Dx3, VisitID.Dx4,
VisitID.Dx5
FROM PatientID INNER JOIN VisitID ON PatientID.Account = VisitID.Account
WHERE VisitID.VisitDate=(SELECT Max(Tmp.VisitDate)
FROM VisitID as Tmp
WHERE Tmp.Account =
VisitID.Account AND
Tmp.VisitDate < Date())
AND PatientID.Print="yes"


Mark M S said:
I am using Access 2002. The answer might be obvious but escapes me now.

I have an Append query based on the records from a VisitID Table with the
criteria filed [VisitDate] Date()-1 and if the patient is Print "Yes".
This then adds the last visits details from the last fields completed.
This works great to bring the last record to the current day (New
Record) - if the patient is seen by someone using the database. If one
day or several days are not completed in the database then it doesn't see
the day before and no records are appended.

How would I set the criteria to use the most recent record saved rather
than the prior day record - some kind of parameter query with the last
visit date?


INSERT INTO VisitID ( Account, ProviderID, AgeInDays, AgeInHours,
Temperature, Pulse, Respirations, [Blood PressureSystolic],
BloodPressureDiastolic, Diagnositic, WeightCurrent, WeightPrevious,
HCCurent, HCPrevious, LCurrent, Cardiac, Pulmonary, Metabolism,
Nutrition, CNS, Infectious, Hematology, Bilirubin, Chemistry, Social,
[Follow-up], Medications, Narrative, ProgressNote, AdmitMD, DailyMD,
DCMD, EENT, Derm, [GI/GU], Dx1, Dx2, Dx3, Dx4, Dx5 )
SELECT PatientID.Account, VisitID.ProviderID, VisitID.AgeInDays,
VisitID.AgeInHours, VisitID.Temperature, VisitID.Pulse,
VisitID.Respirations, VisitID.[Blood PressureSystolic],
VisitID.BloodPressureDiastolic, VisitID.Diagnositic,
VisitID.WeightCurrent, VisitID.WeightPrevious, VisitID.HCCurent,
VisitID.HCPrevious, VisitID.LCurrent, VisitID.Cardiac, VisitID.Pulmonary,
VisitID.Metabolism, VisitID.Nutrition, VisitID.CNS, VisitID.Infectious,
VisitID.Hematology, VisitID.Bilirubin, VisitID.Chemistry, VisitID.Social,
VisitID.[Follow-up], VisitID.Medications, VisitID.Narrative,
VisitID.ProgressNote, VisitID.AdmitMD, VisitID.DailyMD, VisitID.DCMD,
VisitID.EENT, VisitID.Derm, VisitID.[GI/GU], VisitID.Dx1, VisitID.Dx2,
VisitID.Dx3, VisitID.Dx4, VisitID.Dx5
FROM PatientID INNER JOIN VisitID ON PatientID.Account = VisitID.Account
WHERE (((VisitID.VisitDate)=Date()-1) AND ((PatientID.Print)="yes"));
*************************************************
Mark M Simonian MD FAAP

****************************************
Alert: This email and any files transmitted with it
are intended solely for the use of the individual or
entity to whom they are addressed and may contain
confidential, patient health or other legally
privileged information. If you have received this
email in error please notify the sender by email,
delete and destroy this message and its attachments.
Any unauthorized review, use, disclosure,
or distribution is prohibited.
 
Top