whats wrong with my adding

alaric

Registered User.
Local time
Today, 15:39
Joined
Sep 6, 2004
Messages
50
Hi

I have a form where the user can Add new students;
when finished the user clicks on SAVE, the programm asks the question "add a new student"

From here 2 options;
users clicks NO; the record got saved (this works fine)

but when the user clicks YES; (the form textboxes clear)
and you add a student. Now the user doesnt want to SAVE this but cancel the last. So, the user clicks CANCEL.
Now the previous additions (in the last sequence) are not stored either! :(

what part do I mis;
here's my piece of code:

Private Sub cmdSave_Click()
On Error GoTo Err_cmdSave_Click

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

If MsgBox("De gegevens zijn opgeslagen. Wilt u nog een cursist toevoegen?", vbYesNo + vbQuestion + vbDefaultButton2, ConAppName) _
= vbYes Then
DoCmd.GoToRecord , , acNewRec
txtAdrAdd1.SetFocus
Else
DoCmd.Close
Form_FAdresBoek.Requery
Form_FAdresBoek.lstdata.Requery
End If

end sub​

does someone see my fault

thx in advance
Al
 
The record gets saved prior to the requery if you don't undo (cance) it. I don't exacty recall the command.

Try

DoCmd.RunCommand acCmdUndo

before the requery.
 

Users who are viewing this thread

Back
Top Bottom