Microsoft Access Forums

Go Back   Microsoft Access Forums > Access Forums > Queries

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 07-26-2008, 11:01 PM
Novice
 
Join Date: Jul 2008
Posts: 1
majamer is on a distinguished road
Default 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
Reply With Quote
  #2  
Old 08-04-2008, 01:30 AM
Advanced Beginner
 
Join Date: Jul 2008
Location: Alexandria, Egypt.
Posts: 38
Ahmed Elalfy is on a distinguished road
Send a message via Yahoo to Ahmed Elalfy
Default

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
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Data won't show up in table field texzen123 Forms 3 11-26-2009 08:20 AM
Extra date field update georgft Forms 0 09-17-2008 04:51 AM
Update Query with Field based on Combobox Selection Dani1022 Queries 0 04-17-2008 07:24 AM
Update table from calculated field in a form BernardKane Forms 3 11-28-2006 06:48 AM
I need to update a data field on a form and not on its table Wrangler Forms 2 03-15-2006 10:43 PM


All times are GMT -8. The time now is 08:30 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.