And another Autofill question

Mobiusrune

Registered User.
Local time
Today, 18:04
Joined
Jan 7, 2013
Messages
28
Very new to VBA programming (complete noob), but I do know that other autofill threads did not have the information I was looking for, or it may be what I am looking for is elementary enough that I should know, but again...noob. So, this is what is I am after...

I have a db that collects some basic patient demographics and basic information about the patient condition each 12 hr shift. Each shift, this same information (with updates) is entered as a new record (at the request of the unit manager). What I want the staff to be able to do is...

Enter the patient account number in a new record. If the patient account number has been used before, copy the information from the LAST record that used this account number and populate the rest of the fields in the new record. I need the new record to be editable (patients do change from day to day). I know I need to clone the record, but what had been suggested to me by a friend for 2003 did not work with 2007.

Help please?
 
Unfortunately, he bit of code that I was given did not work, so I did not save it. I will have to ask my friend again what the code was that he gave me.

Data is copied from the old record to save input time. It is easier to change the old data instead of entering everything each shift.
 
Code:
DoCmd.GoToRecord , , acNewRec

Code:
Me.Unit_Name = Me.Combo16.Column(1)
Me.Unit_Subdivision = Me.Combo16.Column(2)
Me.BldgNumber = Me.Combo16.Column(3)
Me.Inspection_Type = Me.Combo16.Column(4)
Me.Inspector_Name = Me.Combo16.Column(5)
Me.Construction_Level = Me.Combo16.Column(6)

I use a "new Record" button and execute the first code, then have a second button named "autofill" where I use a combobox that has all the names of the inspections I've done, along with all the information from the record. I hide the information that I don't want to be seen in the combobox (but it's still there.) Then I pick the name that I want and have it autofill the new record. You could substitute Name for Patient number and have it work the same way.
 

Users who are viewing this thread

Back
Top Bottom