I have the following set up:
Tables
Supplier
SupplierContact s
Forms
SupplierRegform
SupplierContact s - subform
On the main form I’m using tab control with two tabs. The first tab contains controls for entering supplier registration information and the second tab contains the subform for entering contacts information for the supplier. On form load i hide the second tab and i set .visible property only if all fields in main form are filled. Once the user presses the button the and all fields are filled in the first tab is hidden and the second one is visualised, but in this moment if i return to the first tab (on second tab i have another button "back to main") and try to exit the form (button here for exit) the record is not deleted. Here is the code for close button:
I tried me.Undo but still nothing.
Can anyone help me i need to stop the records in main form from saving when i move form tab to tab?
Tables
Supplier
SupplierContact s
Forms
SupplierRegform
SupplierContact s - subform
On the main form I’m using tab control with two tabs. The first tab contains controls for entering supplier registration information and the second tab contains the subform for entering contacts information for the supplier. On form load i hide the second tab and i set .visible property only if all fields in main form are filled. Once the user presses the button the and all fields are filled in the first tab is hidden and the second one is visualised, but in this moment if i return to the first tab (on second tab i have another button "back to main") and try to exit the form (button here for exit) the record is not deleted. Here is the code for close button:
Code:
If Me.Dirty Then
If msgbox("Do you realy want to exit?", vbYesNo, "Exit") = vbYes Then
Me.Undo
DoCmd.Close
Else
SavRec.SetFocus
End If
Else
If msgbox("Are you sure you want to exit without saving?", vbYesNo, "Exit") = vbYes Then
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
DoCmd.Close
Else
Me.SavRec.SetFocus
End If
End If
Can anyone help me i need to stop the records in main form from saving when i move form tab to tab?
Comment