Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unable to commit transaction to access database

Status
Not open for further replies.

NickBlake

Programmer
Nov 28, 2003
10
GB
I hope someone can help. I am writing a call logging database with a VB front end that saves the information entered into an access database. I am connecting to the access database via a data control. The program was working up until yesterday however for some reason it has stopped saving the information into the access table. My program involves logging a call and then retrieving it later to update. Since my program stopped working I can log a call and as long as I don't log out of the program I can retrieve it by ref number (which is allocated using the autonumber function in access). However if I log out of the program I lose the information. It seems as if the program is storing the information somewhere in memory while it is running and not committing it to access. Please see below the parts of the code I am using to save the call to the access table. Hope someone can help.

Thanks Nick

option explicit
Dim myTable As Recordset
Dim MyWorkspace As Workspace


private sub form_load()

Set MyWorkspace = Workspaces(0)
Set myTable = Dattest.Recordset
MyWorkspace.BeginTrans

Dattest.Refresh
Dattest.Recordset.AddNew
lblPwRef.Caption = "PWR" + txtPwRef


Private Sub SaveRec_Click()

Dim temp As Variant

If txtName.Text = "" Then
MsgBox "Please complete call details"
ElseIf MsgBox("Save this call?", vbQuestion + vbYesNo, "Save Call") = vbYes Then
txtDateInWorkbasket = Format(Date, "dd/mm/yy")
txtTimeInWorkbasket = Left$(Time, 5)
temp = lblPwRef.Caption
Dattest.Recordset.Update
MyWorkspace.CommitTrans
Unload frmPaperwork
frmPaperworkMain.Show
MsgBox "Your call reference is " + temp, vbDefaultButton4 = vbOKOnly, "Call Reference Number"
Else
MyWorkspace.Rollback
MsgBox "You aborted logging call", vbOKOnly, "Aborted Call"
End If

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top