I wrote a program in MS Access that when user clicks on a command button on the form, data would be extract from a query table into a new MS Excel worksheet using OLEDB.
My error is strange because the error does not occur everytime I click on the command button and there is a patten when the error message appears. So first time I clicked on command button, MS excel worksheet will populate the data with no error. I closed the MS Excel worksheet, click on command button again and error message would come up. Third time no error message. Fourth time has the error message and so on.
Here is my code: Grey color part isn't relevant so can be ignored I just didn't want to not display it in case it might matter. Red is where error occurs.
Please Login or Register to view this content.
Bookmarks