Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2008
    Posts
    1

    Update a field in a table after ordering data in two other fields

    Hello,

    I have a table with one PatientNumber and TestDate fields among others. Each PatientNumber has several records with different TestDate. I added a new field called TestNumber and wanted to sort the table by PatientNumber and TestDate then update the TestNumber field to increment test numbers for each patient by test date. I was able to create the function to increment the numbers for each patient and reset the counter for the next patient, but the problem I'm having is to write an UPDATE SQL statement that does the update after sorting the data by PatientNumber then TestDate. ORDER BY or GROUP BY don't work with UPDATE queries. What's the best way to handle this?

    Thanks,

    Martha

  2. #2
    Join Date
    Jul 2008
    Location
    Alexandria, Egypt.
    Posts
    38
    Dear Martha,

    I think it will be better to craete a new table contains Patients data and add the field TestNumber in this table.
    So you can create a summary query on the old table and update the value in TestNumber in the new table.

    Thanks

    Ahmed

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

Similar Threads

  1. Replies: 3
    Last Post: 10-30-2013, 11:42 AM
  2. Data won't show up in table field
    By texzen123 in forum Forms
    Replies: 3
    Last Post: 11-26-2009, 11:20 AM
  3. Extra date field update
    By georgft in forum Forms
    Replies: 0
    Last Post: 09-17-2008, 06:51 AM
  4. Replies: 0
    Last Post: 04-17-2008, 09:24 AM
  5. Update table from calculated field in a form
    By BernardKane in forum Forms
    Replies: 3
    Last Post: 11-28-2006, 09:48 AM

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