Error 2017: When trying to Rename Forms:

gold007eye

Registered User.
Local time
Today, 15:41
Joined
May 11, 2005
Messages
260
I have a password set on the VB coding to prevent people from viewing the code. This has been working great until I try to use the code below:

Code:
    DoCmd.SetWarnings False
    DoCmd.DeleteObject acTable, "DateFlagged"
    DoCmd.OpenQuery "Clear License"
[COLOR="Red"]    DoCmd.Rename "Logon-D", acForm, "Logon"
    DoCmd.Rename "Logon", acForm, "Logon-R"[/COLOR]
    DoCmd.SetWarnings True
    DoCmd.Close acForm, "Register", acSaveNo
    DoCmd.OpenForm "Logon"

The red text seems to be where I am getting the error.

Error 2017:
"Microsoft helps protect this Visual Basic for Applications Project with a password. You must supply the password in tehe Visual Basic Editor before you cab perform this operation."

Is there a way I can bypass this and still have it rename the forms. Or is there a way I can somehow turn off the password temporarily... run the renaming code... and then turn the password back on? I have been racking my brain and sifting through searches, but haven't found anything like this.

-Jay
 
When is this code called? You are protecting your VB project why not just make an mde?

More information about when and how the code is calls would let us help you :)
 
The code is being called when the users clicks the "Ok" button on the form.

In the end I might go with an MDE, but for now I wanted to try and keep it as an .mdb :)

Does this help?
 
Not delved to deep but this seems a conflicting argument:

DoCmd.Rename "Logon-D", acForm, "Logon"
DoCmd.Rename "Logon", acForm, "Logon-R"

Just a thought but within the code no break maybe... but would definately recommend the .mde path if the code is what you are worried about as whatever you do with ^^^ the code is there to be read either by hacks or thid party programs so however secure you think you have made it someone will find away...

good luck John :)
 
That arguement works perfectly if I manually enter the VBA Password and then click the button that runs the code. Basically what those lines do is:

1st - change the Logon form to "Logon-D"
2nd - change the Logon-R to "Logon"

The reason I did this is so I still keep a local copy of the Demo version of the Logon form so that if a Pirating attempt is made it will revert back to the Demo version and give them a message.

With an .MDE is is possible to rename forms on the fly like this or is all that locked down? I haven't used .MDE before so I'm not sure on it's limitations. And as for the code does it actually hide the code itself or just prevent it from being exported out?

In the end my plan is to distribute as a Run-time app. Is that more of a reason to go to .MDE?

Thanks for your help.
 
This quote explains it better than I could:

An MDE file is the same as a regular Access MDB database file, with the following changes:

  • All VBA procedures are compiled — converted from human-readable code (more or less readable, anyway) to a format that only the computer understands. This change prevents a database user from reading or changing your VBA code.

  • No one can create forms or reports or modify the existing ones (you can't even open them in Design view). You can't import any, either.
Just make sure you keep a backup of the MDB for developement and distribute the MDE.

Regards John :)
 
So with an MDE does that mean renaming (through code) wont work. And deleting a form (through code) won't work either? Hmm.. if that is the case I might have to rethink some stuff. :\
 
Basically, you can't do anything that changes the design of the database.
 

Users who are viewing this thread

Back
Top Bottom