C
Chipcom
Hi
I am using main form and subform and when I focus on the sub form
Access saves the record and I need to know how to stop acces from
saving the record when the subform is on focus?
I understand that I need to unbound the main form and then bound it on
before update event.
I tried this code but I get some errors.
On Error GoTo Error_Handler
Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = CurrentDb
Set rst = db.OpenRecordset("tblWhatever", dbOpenDynaset)
With rst
.AddNew
!WhateverID = Me.txtWhateverID
!FirstName = Me.txtFName
!LastName = Me.txtLName
.Update
End With
Exit_Here:
rst.Close
Set rst = Nothing
Set db = Nothing
Error_Handler:
MsgBox Err.Number
Resume Exit_Here
Hi
I tried the code with form's Before Update even But I getting:
Error 0
Error 20
Error 91
What I do wrong?
I am using main form and subform and when I focus on the sub form
Access saves the record and I need to know how to stop acces from
saving the record when the subform is on focus?
I understand that I need to unbound the main form and then bound it on
before update event.
I tried this code but I get some errors.
On Error GoTo Error_Handler
Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = CurrentDb
Set rst = db.OpenRecordset("tblWhatever", dbOpenDynaset)
With rst
.AddNew
!WhateverID = Me.txtWhateverID
!FirstName = Me.txtFName
!LastName = Me.txtLName
.Update
End With
Exit_Here:
rst.Close
Set rst = Nothing
Set db = Nothing
Error_Handler:
MsgBox Err.Number
Resume Exit_Here
Hi
I tried the code with form's Before Update even But I getting:
Error 0
Error 20
Error 91
What I do wrong?