hi
im trying to be able to cancel multiple record updates on error.
I have a series of record updates to diffrent tables in one subform. I want to be able to say if on the third table update if theres an error to roll back the previous two updates as well.
I ve been trying to use the .cancelupdate method
-Im not getting an error it just keeps going to the error msg
Here is a sample of my code:
On Error GoTo cancelupdate
.Open "User_data", CurConn, , , adCmdTableDirect
.AddNew
![contact_name] = (Me!contact_name)
![First_Name] = (Me!First_Name)
![Last_Name] = (Me!Last_Name)
![contact_name] = (Me!contact_name)
![lm_office] = (Me!lm_office)
![dept] = (Me!dept)
![contact_phone] = (Me!contact_phone)
![lm_contact_extension] = (Me!lm_contact)
![exchange] = (Me!exchange)
![Address] = (Me!Address)
![City] = (Me!City)
![State] = (Me!State)
![Zip] = (Me!Zip)
.Close
.Open "ServiceCenterProblem", CurConn, , , adCmdTableDirect
.AddNew
![number] = (Me!number)
![contact_name] = (Me!contact_name)
![action] = (Me!action)
![update_time] = (Me!MinOfupdate_time)
![lm_updated_by_lastname] = (Me!lm_updated_by)
.Close
With rst
.Open "Inventory", CurConn, , , adCmdTableDirect
.AddNew
![serial_no_] = (Me!serial_no_)
![mfg_id] = DLookup
.Open "InventoryStatusForm", CurConn, , , adCmdTableDirect
.AddNew
![serial_no_] = (Me!serial_no_)
![number] = (Me!number)
![status_id] = (1)
![close_time] = (Me!MaxOfclose_time)
![tech_id] = DLookup
.Close
.update
cancelupdate:
MsgBox Err.Description
With rst
.cancelupdate
End With
!!!!Any help would be greatly appreciated,
Any suggestions on how to do this an alternative way would be cool to.
Thanks
im trying to be able to cancel multiple record updates on error.
I have a series of record updates to diffrent tables in one subform. I want to be able to say if on the third table update if theres an error to roll back the previous two updates as well.
I ve been trying to use the .cancelupdate method
-Im not getting an error it just keeps going to the error msg
Here is a sample of my code:
On Error GoTo cancelupdate
.Open "User_data", CurConn, , , adCmdTableDirect
.AddNew
![contact_name] = (Me!contact_name)
![First_Name] = (Me!First_Name)
![Last_Name] = (Me!Last_Name)
![contact_name] = (Me!contact_name)
![lm_office] = (Me!lm_office)
![dept] = (Me!dept)
![contact_phone] = (Me!contact_phone)
![lm_contact_extension] = (Me!lm_contact)
![exchange] = (Me!exchange)
![Address] = (Me!Address)
![City] = (Me!City)
![State] = (Me!State)
![Zip] = (Me!Zip)
.Close
.Open "ServiceCenterProblem", CurConn, , , adCmdTableDirect
.AddNew
![number] = (Me!number)
![contact_name] = (Me!contact_name)
![action] = (Me!action)
![update_time] = (Me!MinOfupdate_time)
![lm_updated_by_lastname] = (Me!lm_updated_by)
.Close
With rst
.Open "Inventory", CurConn, , , adCmdTableDirect
.AddNew
![serial_no_] = (Me!serial_no_)
![mfg_id] = DLookup
.Open "InventoryStatusForm", CurConn, , , adCmdTableDirect
.AddNew
![serial_no_] = (Me!serial_no_)
![number] = (Me!number)
![status_id] = (1)
![close_time] = (Me!MaxOfclose_time)
![tech_id] = DLookup
.Close
.update
cancelupdate:
MsgBox Err.Description
With rst
.cancelupdate
End With
!!!!Any help would be greatly appreciated,
Any suggestions on how to do this an alternative way would be cool to.
Thanks