Newbi needs a very small help, thank you very much.

Joined
Aug 1, 2007
Messages
3
Reaction score
0
Hello everyone and thank you very much for your time.

I Have a small db for invoicing and on my form (with a subform) there is a CANCEL button which will just cancel what had been selected or entered in the form ... here is the code behind the cancel button...


Private Sub Cancel_Click()

Me![BillsFormSub].Form.Refresh

DoCmd.SetWarnings False

DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70

DoCmd.SetWarnings True


Exit_Cancel_Click:
Exit Sub
End Sub


This was working fine for many years until just recently where I upgraded to Windows XP with SP3 Off XP 2003 and the Access 2002 format. (from Off97)

And now everytime someone clicks the cancel button, I get an error 3021 code, and my bill goes up by one bill number.

I would very much appriciate if you could give me and example of a code replacement for this cancel action that would work in my case.

Sincerely yours,

Mohammad Reza.



P.s in the meantime I have replaced the above two lines with:

DoCmd.RunCommand acCmdDeleteRecord

and it seems it will delete the record as I want it with no error messege, but now the problem is that the form is advancing to a new record even thought the current one is also empty.

If I close and reopen the form though, everything is fine.

I tried pressing ESC twice, and using all sorts of DIRTY UNDO REFRESH and REQUERY commands all to no use, the only way now to get to the last record is to close and reopen the form, any ideas?
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top