I am attempting to add command buttons to a main form that control both the actions on the sub form. For example I want to add a delete button on the main form that would delete a record on the subform. Equally, I would like an UNDO button on my main form that would undo a record on the subform.
When I attempt to add buttons, they do not work. However, if I use the menu/toolbar to accomplish this task it works.
After much trying and guess work I have managed to make it so my delete button on the main form works. This was done by:
1. setting the focus back to the subform in the On click event on the command button. (me.subformname.SetFocus)
2. changing control names used in If...Then...Else statements that are part of my code to reflect subform location eg. If (Me!Subformname.Form![fieldnameonsubform])
This is all great and setting the focus back to the subform seems to work for other command buttons, but I still am having problems with my Undo button.
In the case of undo, once again I can complete the task from the menu/taskbar however from a command button on my form I get message telling me to complete the required data entry for the record (This is an error message I have set up in the subform to ensure complete entry of info prior to exiting the record). If I want to undo a record, how do I get the focus moved to the main form so I can complete the undo task?
I really would appreciate some suggestions on how to deal with the command buttons. Thanks in advance
When I attempt to add buttons, they do not work. However, if I use the menu/toolbar to accomplish this task it works.
After much trying and guess work I have managed to make it so my delete button on the main form works. This was done by:
1. setting the focus back to the subform in the On click event on the command button. (me.subformname.SetFocus)
2. changing control names used in If...Then...Else statements that are part of my code to reflect subform location eg. If (Me!Subformname.Form![fieldnameonsubform])
This is all great and setting the focus back to the subform seems to work for other command buttons, but I still am having problems with my Undo button.
In the case of undo, once again I can complete the task from the menu/taskbar however from a command button on my form I get message telling me to complete the required data entry for the record (This is an error message I have set up in the subform to ensure complete entry of info prior to exiting the record). If I want to undo a record, how do I get the focus moved to the main form so I can complete the undo task?
I really would appreciate some suggestions on how to deal with the command buttons. Thanks in advance