Populate new record with data from old record

G

Guest

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!
 
S

Steve Schapel

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.
 
G

Guest

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
 
S

Steve Schapel

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.
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top