C
CanceledDavid
This happens both in Access 2000 and 2003, in several computers (Win2K & XP)
I am trying to insert a few lines of code in hundreds of forms in an MDB. For development, I am using a 2 form MDB to play with
I open the MDB as an application object called MyAccessObjec
The core of the code are the following three lines
MyAccessObject.DoCmd.OpenForm strForm, acDesign ' OPen the form in design mod
MyAccessObject.Forms(strForm).Module.InsertLines (lngFirstLine + lngLineCount - 1), strCode 'Insert a few lines of cod
Debug.Print MyAccessObject.Forms(strForm).Module.Lines(1, 10) ' Confirm the insertion. Allways looks fin
MyAccessObject.DoCmd.Close acForm, strForm, acSaveYes
This code seems to work. The debug.print shows the old and new code as it should be, but the close command doesn't save. After the program runs, I open the changed MDB directly in access, and the new code is nowhere to be found
So, just before the DoCmd.close, I added
MyAccessObject.DoCmd.Save acForm, strFor
Now I get an error message in Err.Description "The Save action was canceled." in every form, BUT the code is written
I am afraid I can corrupt the MDB because of something is wrong and that's why I am getting this error
I am trying to insert a few lines of code in hundreds of forms in an MDB. For development, I am using a 2 form MDB to play with
I open the MDB as an application object called MyAccessObjec
The core of the code are the following three lines
MyAccessObject.DoCmd.OpenForm strForm, acDesign ' OPen the form in design mod
MyAccessObject.Forms(strForm).Module.InsertLines (lngFirstLine + lngLineCount - 1), strCode 'Insert a few lines of cod
Debug.Print MyAccessObject.Forms(strForm).Module.Lines(1, 10) ' Confirm the insertion. Allways looks fin
MyAccessObject.DoCmd.Close acForm, strForm, acSaveYes
This code seems to work. The debug.print shows the old and new code as it should be, but the close command doesn't save. After the program runs, I open the changed MDB directly in access, and the new code is nowhere to be found
So, just before the DoCmd.close, I added
MyAccessObject.DoCmd.Save acForm, strFor
Now I get an error message in Err.Description "The Save action was canceled." in every form, BUT the code is written
I am afraid I can corrupt the MDB because of something is wrong and that's why I am getting this error