Full Version: Creating a Back Button for a custom wizard
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
BeckyMcE
I have been searching for this and found several ideas to try but haven't had any luck.

I'm trying to create a custom wizard for some very basic users and don't have a lot of time. Haven't been doing a lot of serious programming in a while either but am getting better at VBA.

I have a wizard with next buttons which typically run append queries as they go as several points of data in subforms are the same from form to form. However I want to be able to create a back button for the same forms in case they want to undo. Me.undo works great if the record isn't saved but if it is saved I can not get rid of the parent record.

I can attach a query that deletes the child records in the subform just fine. However if I try to run a delete query on the parent record I get an Access violation error. I have tried to use unbound hidden text boxes on my startup form which stays open at all times and then run a delete query on the activate action of the form the back button is returning to but I still get the access violation error message.

Have also tried accmddeleterecord in the on unload event of the form that owns the back button but get the same messsage.

Ideas? crazy.gif
strive4peace
after you delete the child records...

try this:

currentdb.tabledefs.refresh
DoEvents

after you are sure the records are "deleted" from the children

let me know if your parent record can be deleted then...
BeckyMcE
The refresh helped. I also took a break from it and when I came back I did notice an error in one of my queries which also helped. It's working now thanks! The issue of staring at the same thing too long but I think I'll continue to use the refresh just in case. yayhandclap.gif
strive4peace
you're welcome wink.gif happy to help
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.