hidden vba (1 Viewer)

NickNeville

Registered User.
Local time
Today, 15:29
Joined
May 17, 2009
Messages
119
Would anyone be able to tell me if it is possible to hide code within a database.
I want to get the db to quit on a command but not want the code found.
the db is not protected in any way or levels.
Thankyou
Nick
 
Last edited:

KenHigg

Registered User
Local time
Today, 10:29
Joined
Jun 9, 2004
Messages
13,327
You can put the code in a module and hide the module.
 

NickNeville

Registered User.
Local time
Today, 15:29
Joined
May 17, 2009
Messages
119
Thanks for your quicko reply Ken, sorry to be a pain but could you tell me how. I'm a touch new to this code stuff but can follow info.
Rgds
Nick
 

KenHigg

Registered User
Local time
Today, 10:29
Joined
Jun 9, 2004
Messages
13,327
Right click the module ->properties->attributes->hidden
 

KenHigg

Registered User
Local time
Today, 10:29
Joined
Jun 9, 2004
Messages
13,327
Not sure how to hide just the code behind a form, maybe you can just hide the entire form in the database window the same way you hide the code module.
 

NickNeville

Registered User.
Local time
Today, 15:29
Joined
May 17, 2009
Messages
119
Hiya Ken
I have managed to locate and start a new module, I wondered if you could
tell me how I refer to the Form which I want to use the module for.

I have
If me.text11 >31/05/2013 then
docmd.quit
end if
end sub

But I need to refer to the form where this is used , can you guide m please ?
Rgds
Nick
 

NickNeville

Registered User.
Local time
Today, 15:29
Joined
May 17, 2009
Messages
119
Hi ken
could I ask you to give me a little more help with the "forms!myformname!text11" please.
Do I open a class module or another type, do I add the code to the code like

If me.forms!myformname!text11 text11 >31/05/2013 then
docmd.quit
end if
end sub
Or am I completely off course here
RgdsNick
 

KenHigg

Registered User
Local time
Today, 10:29
Joined
Jun 9, 2004
Messages
13,327
I may have misled you a bit. Putting ALL your code in stand alone modules is probably going to be more work than you want to do and perhaps not even a good idea. I generally put code in stand alone modules when I need it to be either portable (I can copy it over in to other database) or when I need functionality to be available to more than just one form or other object.

Which probably leads back to your original concern of users getting to your code. That begs the question of how do you anticipate them getting to the code. The most common I've seen is when and error occurs and they end up in the vba code window or when they just get curious and browse around the objects fro the database window.

To prevent and error from putting them in the vba code window I suggest including error trapping. You can search for this topic and get a better understanding if you don't already know how to implement it.

To prevent users from accessing objects from the database window I would simple hide it by disabling it with the Tools->start up->Display database window option. This does not mean that a persistent user could not find away around this but it will discourage most. Nothing is 100% secure :)

Hope this helps.

As for you code question, you do not use the me. in front of an object reference when you fully qualify it with the forms!myformanme! prefix. :)
 

NickNeville

Registered User.
Local time
Today, 15:29
Joined
May 17, 2009
Messages
119
HI ken
thanks for that, I have gone thru the tools options startup and yes that does seem a better idea to hise the options thankyou.
But how can I reverse that ! as having unticked all the boxes I know don't have the option of tools etc .....sorry about this !
Nick
 

NickNeville

Registered User.
Local time
Today, 15:29
Joined
May 17, 2009
Messages
119
OK Ken Iv'e found it, shift when click on icon !
many thanks for your patience, this works a treat
Nick
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 15:29
Joined
Sep 12, 2006
Messages
15,710
i am pretty sure that hiding a module is only of minor use.

it is as easy to unhide stuff. Simple things like this may defeat casual prying eyes, but anyone with a little experience of access will discover your code.
 

NickNeville

Registered User.
Local time
Today, 15:29
Joined
May 17, 2009
Messages
119
Thanks Gemma
I realise this, butI guess the only real way is to protect evertything but what a process that is ! This is why `I thought to make a separate module and put it somewhere Not obvious.
Me being a new boy to this coding stuff it's a minefield ....
but thanks anyway
kind rgds
nick
 

Users who are viewing this thread

Top Bottom