Code on form

bar891

Registered User.
Local time
Tomorrow, 04:36
Joined
May 7, 2008
Messages
39
I have the following code on a form to update the receipt number:-

Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("SELECT recNum FROM table2")
NextNo = rs!RECNUM + 1
'now update the table
rs.Edit
rs!RECNUM = NextNo
rs.Update
rs.Close
Set rs = Nothing

What do i have to ad to this so that when i cancel a form it doesn't increase the number?

Many Thanks
 
i think all you would have to do is just a cancel button (just run through the wizard when you place a button and select close form action)
 
I have already tried that and it still increases the number.....Any other thoughts?
 
Simple Software Solutions

Where on your form are you using this code?
 
Behind your "cancel" button have you tried a simple Me.Undo?
 
I'm using it "on load" event......how do i use me.undo?
 

Users who are viewing this thread

Back
Top Bottom