R
RM Ashraf
Hi
please help me, access is giving a weared and hard time :-(
I have a form with 3 subforms in different tab pages. My form has a Cancel
button which simply use Undo to clear all forms and then set there
properties. The problem is that if I insert data in the main form and press
cancel, it works fine and clear and undo add data insertion. But if I have
any data in the form and in any of subforms, instead of doing Undo all data
insertion, it saves all information to the database. Following is my code:
Private Sub ClinicInfoCancel_Click()
On Error GoTo Err_ClinicInfoCancel_Click
Dim recNum As Integer
Me.VisitDate.SetFocus
recNum = Me.Form.Recordset.AbsolutePosition
Me.HistorySymptoms.Form.undo 'Used just to make sure all is undone
Me.OperationNotes.Form.undo
Me.Drug.Form.undo
Me.Form.undo
If recNum >= 0 Then
Me.Recordset.Requery
Me.Form.Requery
Me.HistorySymptoms.Form.Requery
Me.OperationNotes.Requery
Me.Drug.Form.Requery
DoCmd.GoToRecord , , acLast
DoCmd.GoToRecord , , acFirst
DoCmd.GoToRecord , , acGoTo, recNum + 1
Me.AllowAdditions = False
Me.AllowEdits = False
Me.ClinicInfoSave.Enabled = False
Me.ClinicInfoAdd.Enabled = True
Me.ClinicInfoEdit.Enabled = True
Me.ClinicInfoCancel.Enabled = False
Me.ClinicInfoClose.Enabled = True
Me.HistorySymptoms.Form.AllowAdditions = False
Me.HistorySymptoms.Form.AllowEdits = False
Me.OperationNotes.Form.AllowAdditions = False
Me.OperationNotes.Form.AllowEdits = False
Me.Drug.Form.AllowAdditions = False
Me.Drug.Form.AllowEdits = False
Else
''Similar code like above but with different button enabling options.
End if
Don't know why above code is saving when I am asking anywhere. Any help
would be really appreciated.
Rashid
please help me, access is giving a weared and hard time :-(
I have a form with 3 subforms in different tab pages. My form has a Cancel
button which simply use Undo to clear all forms and then set there
properties. The problem is that if I insert data in the main form and press
cancel, it works fine and clear and undo add data insertion. But if I have
any data in the form and in any of subforms, instead of doing Undo all data
insertion, it saves all information to the database. Following is my code:
Private Sub ClinicInfoCancel_Click()
On Error GoTo Err_ClinicInfoCancel_Click
Dim recNum As Integer
Me.VisitDate.SetFocus
recNum = Me.Form.Recordset.AbsolutePosition
Me.HistorySymptoms.Form.undo 'Used just to make sure all is undone
Me.OperationNotes.Form.undo
Me.Drug.Form.undo
Me.Form.undo
If recNum >= 0 Then
Me.Recordset.Requery
Me.Form.Requery
Me.HistorySymptoms.Form.Requery
Me.OperationNotes.Requery
Me.Drug.Form.Requery
DoCmd.GoToRecord , , acLast
DoCmd.GoToRecord , , acFirst
DoCmd.GoToRecord , , acGoTo, recNum + 1
Me.AllowAdditions = False
Me.AllowEdits = False
Me.ClinicInfoSave.Enabled = False
Me.ClinicInfoAdd.Enabled = True
Me.ClinicInfoEdit.Enabled = True
Me.ClinicInfoCancel.Enabled = False
Me.ClinicInfoClose.Enabled = True
Me.HistorySymptoms.Form.AllowAdditions = False
Me.HistorySymptoms.Form.AllowEdits = False
Me.OperationNotes.Form.AllowAdditions = False
Me.OperationNotes.Form.AllowEdits = False
Me.Drug.Form.AllowAdditions = False
Me.Drug.Form.AllowEdits = False
Else
''Similar code like above but with different button enabling options.
End if
Don't know why above code is saving when I am asking anywhere. Any help
would be really appreciated.
Rashid