Presumably qry_FirstDate_TEPRecords is intended to return the first date
on
file for the patient.
You could try the following, but it may be slow if your table is large:
UPDATE tbl_NewPatientInfo
SET [Reason for referral] = "Initial Fit"
WHERE DateDiff("d", [Date 1st TEP],
DMin("NameOfDateField", "tbl_NewPatientInfo", "[MDACC#] = '" & [MDACC#] &
"'")) < 30
I've assumed that MDACC# is a text field.
Replace NameOfDateField with the appropriate field name.
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
Radhika said:
Thank you
I am still having trouble.
Below is my SQL:
UPDATE tbl_NewPatientInfo INNER JOIN qry_FirstDate_TEPRecords ON
tbl_NewPatientInfo.[MDACC#] = qry_FirstDate_TEPRecords.[MDACC#] SET
tbl_NewPatientInfo.[Reason for referral] = "Initial Fit"
WHERE (((DateDiff("d",[tbl_NewPatientInfo].[Date 1st
TEP],[MinOfDate]))<30));
I keep getting a message saying 'Operation must use an updateable
query'.
The table 'tbl_NewPatientInfo' is on the one side of a one-to-many
relationship. In the above query, it is linked to another qry that
selects
the first date for each ID# (I need to first day to make the datediff
calculation).
Is there something that I am doing incorrectly.
Thank you!
:
UPDATE MyTable
SET ReasonForVisit = "Initial Fit"
WHERE DateDiff("d", [InitialDate], [DateofSurgery]) < 30
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
I have a query with the following information
1. ID#
2. InitialDate
3. DateofSurgery
4. ReasonForVisit
5. Date diff (calculated) = InitalDate-DateofSurgery
I want to update fields in ReasonforVisit such that: If Datediff is
less
than 30, ReasonForVisit=Initial Fit.
I tried to do this using an update query, but I get a message saying
that
I
must use an updateable query.
What am i doing wrong?
Thank you,
Shukla