Hi,

I have written some macro in VBA. It has 2 buttons one is SUBMIT and another is CANCEL. When i click on SUBMIT then it calls access and populate the data in another excel file and takes around 20-30 minutes to populate/complete the process. What I want is on click on CANCEL it should stop the process.

Any help will be appreciated.

i guess when u say populate u mean ur running inside a loop and populate one by one.. so all u need to do is put DOevents in your code.. in side the loop so you could still cancel ur work..

By using DoEvents u can return control back to O/S after every loop,so that u can break the loop in between if required.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.