![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Using A2007. *I've got an accdb that links reasons given for treatment refusal to a list of patients. *Currently the reasons are numbered 1 thru 70. *These reasons are stored in a lookup table with a PK autonumber, called ReasonID, and the reason description. *There is a one-to-many relationship to another table that stores patient ID and ReasonsID. The user wants me to replace the current reasons table with a new table. *The "new" reasons are numbered 1 thru 19 with new descriptions. *For example, Reason #1 is now Reason #15, Reason #15 is now Reason #28. Reason #18 is now #12. *How would I update the related table with the new ReasonID? *At first I thought a simple find-and- replace would work. *But if I replace all of reason #1 with Reason #15, then replace reason #15 with reason #28 then I've actually replaced all Reason #1 with Reason #28, haven't I? I thought about working backwards in the list. *Replace Reason 15 with 28, then replace 1 with 15. *But that won't work because I have to replace 18 with 12, then 12 with 15. *Then I've replaced all 12's with 15's. Hopefully I'm missing something obvious here. *Any help or advice would be appreciated. |
#3
| |||
| |||
|
|
On Mar 10, 3:07 pm, emanning <emann... (AT) kumc (DOT) edu> wrote: Using A2007. I've got an accdb that links reasons given for treatment refusal to a list of patients. Currently the reasons are numbered 1 thru 70. These reasons are stored in a lookup table with a PK autonumber, called ReasonID, and the reason description. There is a one-to-many relationship to another table that stores patient ID and ReasonsID. The user wants me to replace the current reasons table with a new table. The "new" reasons are numbered 1 thru 19 with new descriptions. For example, Reason #1 is now Reason #15, Reason #15 is now Reason #28. Reason #18 is now #12. How would I update the related table with the new ReasonID? At first I thought a simple find-and- replace would work. But if I replace all of reason #1 with Reason #15, then replace reason #15 with reason #28 then I've actually replaced all Reason #1 with Reason #28, haven't I? I thought about working backwards in the list. Replace Reason 15 with 28, then replace 1 with 15. But that won't work because I have to replace 18 with 12, then 12 with 15. Then I've replaced all 12's with 15's. Hopefully I'm missing something obvious here. Any help or advice would be appreciated. I think I may have answered my own question. First, create a new column in the patient table and call it NewReasonID. Run the table thru an update query, once for each reason, and if "old" reason = 1 then NewReasonID = 15, if "old" reason = 15 then NewReasonID = 28, and so on. When finished, delete the old reason column and rename NewReason to what the old reason column was named. Re-establish the relationship with the new reasons table and I should be good to go. Please advise if that's not the best way to handle it. Thanks. |
![]() |
| Thread Tools | |
| Display Modes | |
| |