If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Populate new record with data from old record
My form contains a combo box from which I can select the name of my patient.
The form has a subform which brings up the orders for the selected patient from yesterday (if that patient existed yesterday). I would like to be able to have the subform open a new record where the data fields default to the same values as yesterday's data for that specific patient. Right now the lookup brings up yesterday's data for the patient but when I make changes to the orders then that record is changed. (i.e. I need to keep one record per day for each patient, not just keep changing the same record and only have that one record in the database at any given time). Thanks for your help! |
#2
|
|||
|
|||
Debbiburr,
It sounds like your subform is in single view. Would it work for you to have a continuous view subform? That way, you could see yesterday's orders, plus a blank record underneath it for the entry of today's. -- Steve Schapel, Microsoft Access MVP debbiburr wrote: My form contains a combo box from which I can select the name of my patient. The form has a subform which brings up the orders for the selected patient from yesterday (if that patient existed yesterday). I would like to be able to have the subform open a new record where the data fields default to the same values as yesterday's data for that specific patient. Right now the lookup brings up yesterday's data for the patient but when I make changes to the orders then that record is changed. (i.e. I need to keep one record per day for each patient, not just keep changing the same record and only have that one record in the database at any given time). Thanks for your help! |
#3
|
|||
|
|||
Hi Steve,
It would work best if there was only one record on the screen. The reason I would like to populate the new record with the same data as yesterday's record is because the physician's usually (80% of the time) will write "same as yesterday". It would just be handier to have it on the screen as default values. The orders are fairly complex and the subform takes up the entire screen. Thanks, Debbi "Steve Schapel" wrote: Debbiburr, It sounds like your subform is in single view. Would it work for you to have a continuous view subform? That way, you could see yesterday's orders, plus a blank record underneath it for the entry of today's. -- Steve Schapel, Microsoft Access MVP debbiburr wrote: My form contains a combo box from which I can select the name of my patient. The form has a subform which brings up the orders for the selected patient from yesterday (if that patient existed yesterday). I would like to be able to have the subform open a new record where the data fields default to the same values as yesterday's data for that specific patient. Right now the lookup brings up yesterday's data for the patient but when I make changes to the orders then that record is changed. (i.e. I need to keep one record per day for each patient, not just keep changing the same record and only have that one record in the database at any given time). Thanks for your help! |
#4
|
|||
|
|||
Debbi,
Ok, thanks for the further explanation. So, I would suggest changing your procedure for when the patient's record is accessed, that it goes to a new record on the subform. Not sure how you're doing things there already, but possibly a new line in the code like this is needed... DoCmd.GoToRecord , , acNewRec Then you can just set up the Default Value of the applicable form control to the previous day's data. The easiest way to do this is probably to make a query that returns the orders for the selected patient, sorted in descending order of date, and then use the DOllkup function to assign the default value. If you need more specific help with this, please post back with more details. -- Steve Schapel, Microsoft Access MVP debbiburr wrote: Hi Steve, It would work best if there was only one record on the screen. The reason I would like to populate the new record with the same data as yesterday's record is because the physician's usually (80% of the time) will write "same as yesterday". It would just be handier to have it on the screen as default values. The orders are fairly complex and the subform takes up the entire screen. Thanks, Debbi |
#5
|
|||
|
|||
Hi Steve,
Yep, this will work. I had been just using the patient data table as the source for the subform, selecting just those records whose patient name matched the name selected in the combo box in the main form. I'll just switch to using a query as the source and doing what you suggested. Thanks for the help! I appreciate it lots! Debbi "Steve Schapel" wrote: Debbi, Ok, thanks for the further explanation. So, I would suggest changing your procedure for when the patient's record is accessed, that it goes to a new record on the subform. Not sure how you're doing things there already, but possibly a new line in the code like this is needed... DoCmd.GoToRecord , , acNewRec Then you can just set up the Default Value of the applicable form control to the previous day's data. The easiest way to do this is probably to make a query that returns the orders for the selected patient, sorted in descending order of date, and then use the DOllkup function to assign the default value. If you need more specific help with this, please post back with more details. -- Steve Schapel, Microsoft Access MVP debbiburr wrote: Hi Steve, It would work best if there was only one record on the screen. The reason I would like to populate the new record with the same data as yesterday's record is because the physician's usually (80% of the time) will write "same as yesterday". It would just be handier to have it on the screen as default values. The orders are fairly complex and the subform takes up the entire screen. Thanks, Debbi |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Format on data to import to Access tables? (I need your advice) | Niklas Östergren | General Discussion | 5 | December 13th, 2004 02:54 PM |
transpose | john | Using Forms | 1 | November 24th, 2004 06:16 PM |
Putting code in a subform? | Maury Markowitz | General Discussion | 14 | October 25th, 2004 11:32 AM |
New record data is empty in Report View | Dave | General Discussion | 3 | June 4th, 2004 11:28 PM |
Importing selected data into a Word by selecting the relevant record??? | Dale Holden | Worksheet Functions | 0 | April 15th, 2004 04:42 AM |