Transaction Automicity does not work.

  • Thread starter Thread starter zywh
  • Start date Start date
Z

zywh

Guest
In the button click event of a MS Access form I've written the following transaction.

Private Sub Command5_Click()

ado_send1.BeginTrans

ado_send1.Execute "Insert into StudentNew" & _
"(VT_Code, SchoolCode,Grade,Name,fatherName,Sex,Age,Category, RegNo,FamilyRegNo,OldStuID) " & _
"SELECT VT_Code, SchoolCode,Grade, " & _
"Name, fatherName, Sex, Age, Category, " & _
"RegNo, FamilyRegNo,ID from MaungDawFDPStudent where id=" & OldStudents.Form.Recordset.Fields("ID").Value

ado_send1.Execute "Update MaungDawFDPStudent set sendstatus=yes where id=" & OldStudents.Form.Recordset.Fields("ID").Value

ado_send1.CommitTrans

End Sub

The above code does not work sometimes. Can anyone help me on how can I solve this?

Thanks
 
As I've mentioned in transaction, one is to insert and another one is to update. I've linked with "StudentNew" and "MaungDawFDPStudent" tables to each form. So if the above code works, a new student is shown in the form linked with "StudentNew" and disappeared in the form linked with "MaungDawFDPStudent".
Sometimes, When I press send button(command5_Click), it does not do like what I've explained.
 

Users who are viewing this thread

Back
Top Bottom