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!

Saving new record deletes earlier record 1

Status
Not open for further replies.

THWatson

Technical User
Apr 25, 2000
2,601
CA
Using Access 2000

I developed a database for a volunteer group. On an input form, the user wanted a "Save" button with something to indicate that the record was in fact being saved. I therefore put the following code behind the Save button.

Code:
Private Sub cmdSave_Click()
On Error GoTo Err_cmdSave_Click

Me.TimerInterval = 100
    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Me.cmdNew.Enabled = True
If Me.NewRecord Then
If Me.RecordsetClone.Restartable Then
Me.RecordsetClone.Requery
DoCmd.GoToRecord , , acLast
End If
End If

Exit_cmdSave_Click:
    Exit Sub

Err_cmdSave_Click:
    MsgBox Err.Description
    Resume Exit_cmdSave_Click
    
End Sub

This works perfectly on both my laptop and my desktop computer. HOWEVER, what happens on the user's computer is that when the new record is saved an earlier record is deleted. Generally, the first record in the recordset is removed. On a couple of testing occasions, the previous record was removed.

Any ideas as to why this might happen on the user's computer when not occuring on mine?

All machines are running Office 2000, Windows XP with Service Pack 2.

Tom
 
I can't see anything that would delete a record but this seems a bit verbose just to save a record, I would be tempted to use:
DoCmd.RunCommand acCmdSaveRecord
MsgBox "Record has been saved!"

Frank J Hill
FHS Services Ltd.
frank@fhsservices.co.uk
 
Frank
It could well be that verbosity has done me in. I'll try that suggestion on the user's machine and see if that does it.

Thanks!

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top