Hello everyone.
I have a fairly complex access database with multiple tables, queries and forms. Some forms are embedded in other forms. It is a database that I have worked with in the past and it functions correctly. I am now trying to add some additional functionality and I have not been able to figure how to do it even after searching the posts on this site.
I have a functioning command button that will add a new record within an embedded from. I now want this command button to not only open a new record but to auto-populate certain fields based on the previous record entered. I also want to create two additional command buttons that will add a new record and auto-populate different fields based on the previous record entered.
I suspect that I need code attached to the "On Click" event of the command button but I am not experienced in writing code from scratch.
Hopefully this gives everyone enough information to start a dialogue.
Here is the VBA code for the command button:
Private Sub AddNewPlotCommand_Click()
On Error GoTo Err_AddNewPlotCommand_Click
DoCmd.GoToRecord , , acNewRec
Exit_AddNewPlotCommand_Click:
Exit Sub
Err_AddNewPlotCommand_Click:
MsgBox Err.Description
Resume Exit_AddNewPlotCommand_Click
End Sub
I have a fairly complex access database with multiple tables, queries and forms. Some forms are embedded in other forms. It is a database that I have worked with in the past and it functions correctly. I am now trying to add some additional functionality and I have not been able to figure how to do it even after searching the posts on this site.
I have a functioning command button that will add a new record within an embedded from. I now want this command button to not only open a new record but to auto-populate certain fields based on the previous record entered. I also want to create two additional command buttons that will add a new record and auto-populate different fields based on the previous record entered.
I suspect that I need code attached to the "On Click" event of the command button but I am not experienced in writing code from scratch.
Hopefully this gives everyone enough information to start a dialogue.
Here is the VBA code for the command button:
Private Sub AddNewPlotCommand_Click()
On Error GoTo Err_AddNewPlotCommand_Click
DoCmd.GoToRecord , , acNewRec
Exit_AddNewPlotCommand_Click:
Exit Sub
Err_AddNewPlotCommand_Click:
MsgBox Err.Description
Resume Exit_AddNewPlotCommand_Click
End Sub
Last edited: