C
Cory
I'm using Access 2007 on Vista.
I have a form with a command button that I use to view a second form. The
second form is always being programmatically modified so I have a default
form that I want to start with every time, copy it, then make the changes to
the form and open it. Here's the code I was using:
Private Sub cmd_Modify_Schedule_Click()
' Turn off warnings so the form is overwritten if it already exists
DoCmd.SetWarnings False
' Copy the default form to the Manpower Scheduling form
DoCmd.CopyObject , "frm_tmp_Scheduling_Manpower", acForm,
"frm_ZDefault"
DoCmd.SetWarnings True
' Make changes to the form here
DoCmd.OpenForm "frm_tmp_Scheduling_Manpower", , , , acFormReadOnly
End Sub
Everything worked fine until I locked the VBA project for viewing. When I
click the command button and the VBA project is locked I get a run-time error
(#2501) "The CopyObject action was canceled." If I unlock the project, it
runs as expected. I obviously would like to keep the project locked to
prevent anybody from tinkering with my code so any help would be greatly
appreciated. Thanks.
-Cory
I have a form with a command button that I use to view a second form. The
second form is always being programmatically modified so I have a default
form that I want to start with every time, copy it, then make the changes to
the form and open it. Here's the code I was using:
Private Sub cmd_Modify_Schedule_Click()
' Turn off warnings so the form is overwritten if it already exists
DoCmd.SetWarnings False
' Copy the default form to the Manpower Scheduling form
DoCmd.CopyObject , "frm_tmp_Scheduling_Manpower", acForm,
"frm_ZDefault"
DoCmd.SetWarnings True
' Make changes to the form here
DoCmd.OpenForm "frm_tmp_Scheduling_Manpower", , , , acFormReadOnly
End Sub
Everything worked fine until I locked the VBA project for viewing. When I
click the command button and the VBA project is locked I get a run-time error
(#2501) "The CopyObject action was canceled." If I unlock the project, it
runs as expected. I obviously would like to keep the project locked to
prevent anybody from tinkering with my code so any help would be greatly
appreciated. Thanks.
-Cory