Results 1 to 2 of 2
  1. #1
    NickWren is offline Advanced Beginner
    Windows XP Access 2013
    Join Date
    Dec 2015
    Location
    Connecticut
    Posts
    70

    Query Update/Select Query (Wont Update)

    I have 2 tables, one table that will have basic Patient information and the second has the Sample Information

    Code:
    tblPatients:
    -PatientID (PK)
    -PatientName
    -DOB
    -Ethnicity
    -Sex
    -Location
    -...
    -DateOfLastTest (Needs to update from Update Query)
    Code:
    tblSampleStatus:
    -SampleID (PK)
    -PatientID (FK)
    -DateOfTest (What needs to be put into [tblPatients]![DateOfLastTest]
    -Test1Score
    -Test2Score
    Code:
    qryLastestTestInfo:
    SELECT tblPatient.PatientID, Max(tblSampleStatus.DateReceived) AS MaxOfDateReceived
    FROM tblPatient INNER JOIN tblSampleStatus ON tblPatient.PatientID = tblSampleStatus.PatientID
    GROUP BY tblPatient.PatientID;
    Pretty much gives me a PatientID and DateOfLastTest

    Code:
    qryPatientFollowUP:
    SELECT tblPatient.PatientID, tblPatient.PatientName, tblPatient.PatientPhoneNumber, tblPatient.PatientEmail, tblPatient.PatientAddress, tblPatient.City, tblPatient.State, tblPatient.ZipCode, tblPatient.RegistrationDate, tblSampleStatus.DateReceived, tblPhysicians.PhysicianFullName, tblPhysicians.PhysicianPhoneNumber, tblPhysicians.FacilityFullName, tblPhysicians.FacilityAddress, tblPhysicians.FacilityCity, tblPhysicians.FacilityStateAbbreviation, tblPhysicians.ZipCode, tblPhysicians.FacilityFax, tblPatient.LastTestDate
    FROM tblPhysicians INNER JOIN ((tblPatient INNER JOIN tblSampleStatus ON tblPatient.PatientID = tblSampleStatus.PatientID) INNER JOIN tblPhoneLog ON tblPatient.PatientID = tblPhoneLog.PatientID) ON tblPhysicians.PhysicianLastName = tblPatient.PhysicianLastName;
    This is an Update Query that will take the [tblSampleStatus]![DateOfTest] and input it in for [tblPatient]![DateOfLastTest];


    however I keep getting an error that says: "Operation must use an updateable query."
    I figure its the query I use to get the max date, but how else would I go about doing this?

    Also this query will show multiple of the same patient, however I want it to only show the patient once, how can I fix that.

  2. #2
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Yes, you cannot use an Aggregate Query in any part of an Update Query.
    But the question is, do you really need to store the Date of the Last Test in a table?
    Anything that can be calculated "on-the-fly" usually does not need to be stored at the Table level (and probably shouldn't be, as it usually violates Rules of Normalization and can compromise database integrity).

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 12-03-2014, 10:28 PM
  2. Select Query > Update Query > Table Field
    By tuggleport in forum Queries
    Replies: 2
    Last Post: 08-09-2012, 07:04 AM
  3. Replies: 1
    Last Post: 04-14-2011, 07:19 AM
  4. Replies: 2
    Last Post: 01-31-2011, 08:31 AM
  5. Update query using iif and select
    By josh2009 in forum Queries
    Replies: 1
    Last Post: 04-23-2010, 11:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums