I want to create a button that has a macro that will make a duplicate of the last record, and then the user can change one or two items? This is to save them a lot of data entry. Is this possible? I would use VBA also if that helps.
This might be a bit long and tedious but what you can do is this:
Dim value1 As Variant 'value of field you want to copy to new rec
If MsgBox("Would you like to copy data across from this record to the new record?", vbYesNo, "NEW RECORD" = 6 Then
value1 = Me![fieldname]
DoCmd.GoToRecord , , acNewRec
Me![fieldname] = value1
Else
DoCmd.GoToRecord , , acNewRec
Thanks for your help. I actually took a programming course 4 years ago, that used VBA as the programming language, but I can't seem to get the code into the macro builder. I think I understand what the code is trying to do, but I can't get it entered in the right place.
No, I just want a button that will make a duplicate entry, that the user can then edit the few items that are different. I can use VBA or anything else you think is appropriate.
Then all you have to do is create a button (which you can find on the tool bar menu) and then bring up the properties for that button. In the event section click the ... button next to the on_click event. Choose code and it will open up a new window of code. Enter the before mentioned code (changed to suit your needs) and u r done! If you have any probs let me know (robbb@ealing.gov.uk)
thats true. I'm assuming you have a unique number for each record (ie autonumber) that you wernt interested in copying over. If you do have then the way i suggested will work as the records wont be identical (ie the autonumber will set them apart). If not then you may want to think about giving each record a unique identifier.
I do have a field with a unique number that is autonumbered, and as long as it makes a distinct copy, I assumed it would be autonumbered to the next record.
yup thats how it will work! Just copy accross the fields that are most likely to be needed for the new record. It doesnt even have to be the last record that will be copied, just any record the user is currently viewing.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.