Here is another way to implement netSurfer's first idea, only instead of using a global variable, use the Save button's Tag property.
I have found the Tag property to be very useful (especially in control arrays where all controls have the same name and are only differentiated by an index).
Simply set the Tag property (which is a string) of the Save button to the caption of the last button clicked. Do this under the click event of the NewRecord button and the Changes button.
Here's an example:
Hope that helps!Code:Option Explicit Private Sub Form_Load() 'Make sure tag is empty when form loads cmdSave.Tag = "" End Sub Private Sub cmdChanges_Click() cmdSave.Tag = "Changes" End Sub Private Sub cmdNewRecord_Click() cmdSave.Tag = "NewRecord" End Sub Private Sub cmdSave_Click() If cmdSave.Tag = "Changes" Then 'Put code here that reflects that user 'clicked the "Change" button ElseIf cmdSave.Tag = "NewRecord" Then 'Put code here that reflects that user 'clicked the "New Record" button Else 'Put code here that reflects that user 'didn't click either button first End If End Sub
~seaweed




Reply With Quote