Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Reply
 
Thread Tools Rating: Thread Rating: 13 votes, 4.62 average. Display Modes
Old 10-10-2002, 07:05 AM   #1
jonnymenthol
Newly Registered User
 
Join Date: Oct 2001
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
jonnymenthol
Holding down Shift

Hello all,

Is there any way of stopping users of my database from holding down Shift and getting into the database.

I however, still need some sort of facility to do this, so I can add new forms, queries etc whenever necessary.

Thank you in advance, and apologies if this is not the correct place to post, but I'm very new at this.

Thanks.

J.

jonnymenthol is offline   Reply With Quote
Old 10-10-2002, 08:29 AM   #2
ghudson
Newly Registered User
 
ghudson's Avatar
 
Join Date: Jun 2002
Location: USA
Posts: 6,199
Thanks: 1
Thanked 85 Times in 49 Posts
ghudson has a spectacular aura about ghudson has a spectacular aura about ghudson has a spectacular aura about
Cool

The below function and command button code will allow you to use a password
protected input box to determine if the Shift key can be disabled or not.

You might have to set your "References" to DAO 3.6. When you are viewing
the module, click the Tools menu >>> References >>> and Browse for Microsoft
DAO 3.6 >>> Select "Files of type: Executable Files (*.exe; *.dll)"
My DLL was located @ C:\Program Files\Common Files\Microsoft Shared\DAO.

Copy this function into a new public module.
Code:
Public Function SetProperties(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer
On Error GoTo Err_SetProperties
    
    'Dim db As Database, prp As Property
    Dim db As DAO.Database, prp As DAO.Property
    
    Set db = CurrentDb
    db.Properties(strPropName) = varPropValue
    SetProperties = True
    Set db = Nothing
    
Exit_SetProperties:
    Exit Function
    
Err_SetProperties:
    If Err = 3270 Then 'Property not found
        Set prp = db.CreateProperty(strPropName, varPropType, varPropValue)
        db.Properties.Append prp
        Resume Next
    Else
        SetProperties = False
        MsgBox "Runtime Error # " & Err.Number & vbCrLf & vbLf & Err.Description
        Resume Exit_SetProperties
    End If
    
End Function
Assign this to the OnClick event of a command (transparent?) button named "bDisableBypassKey".
Change the "TypeYourPasswordHere" default password.
This sub ensures the user is the programmer needing to disable the Bypass Key.
You can not format an Input Box!
Code:
Private Sub bDisableBypassKey_Click()
On Error GoTo Err_bDisableBypassKey_Click
    
    Dim strInput As String
    Dim strMsg As String
    
    Beep
    strMsg = "Do you want to enable the Bypass Key?" & vbCrLf & vbLf & "Please key the programmer's password to enable the Bypass Key."
    strInput = InputBox(Prompt:=strMsg, Title:="Disable Bypass Key Password")
    
    If strInput = "TypeYourPasswordHere" Then
        SetProperties "AllowBypassKey", dbBoolean, True
        Beep
        MsgBox "The Bypass Key has been enabled." & vbCrLf & vbLf & "The Shift key will allow the users to bypass the startup options the next time the database is opened.", vbInformation, "Set Startup Properties"
    Else
        Beep
        SetProperties "AllowBypassKey", dbBoolean, False
        MsgBox "Incorrect ''AllowBypassKey'' Password!" & vbCrLf & vbLf & "The Bypass Key was disabled." & vbCrLf & vbLf & "The Shift key will NOT allow the users to bypass the startup options the next time the database is opened.", vbCritical, "Invalid Password"
        Exit Sub
    End If
    
Exit_bDisableBypassKey_Click:
    Exit Sub
    
Err_bDisableBypassKey_Click:
    MsgBox "Runtime Error # " & Err.Number & vbCrLf & vbLf & Err.Description
    Resume Exit_bDisableBypassKey_Click
    
End Sub
HTH
__________________
.................................................. ......
Searching this forum or Microsoft.com or MSDN.com or Google is a great way to discover and learn the answers to your Access programming questions.

Well if it seems to be real, it's illusion...

I am using Access 2010 with Windows 7

The
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
function on this forum really does work.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

.................................................. ......

Last edited by ghudson; 03-19-2003 at 06:25 PM.
ghudson is offline   Reply With Quote
Old 10-10-2002, 12:59 PM   #3
Rob.Mills
Registered User
 
Join Date: Aug 2002
Location: Raleigh, NC USA
Posts: 871
Thanks: 0
Thanked 0 Times in 0 Posts
Rob.Mills
ghudson's code is the best I've come across for doing what you're looking for. I've tried others but this prevents anyone from figuring it out.

Rob.Mills is offline   Reply With Quote
Old 10-10-2002, 06:30 PM   #4
ghudson
Newly Registered User
 
ghudson's Avatar
 
Join Date: Jun 2002
Location: USA
Posts: 6,199
Thanks: 1
Thanked 85 Times in 49 Posts
ghudson has a spectacular aura about ghudson has a spectacular aura about ghudson has a spectacular aura about
Cool

Thanks for the compliment Rob.Mills. It is simple yet very effective for keeping the riffraff out. I bet I average one posting per week with this code on at least one forum.
__________________
.................................................. ......
Searching this forum or Microsoft.com or MSDN.com or Google is a great way to discover and learn the answers to your Access programming questions.

Well if it seems to be real, it's illusion...

I am using Access 2010 with Windows 7

The
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
function on this forum really does work.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

.................................................. ......
ghudson is offline   Reply With Quote
Old 10-11-2002, 12:34 AM   #5
jonnymenthol
Newly Registered User
 
Join Date: Oct 2001
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
jonnymenthol
ghudson - Thanks very much for your response.

The code is first class, and it worked a treat.

It's people like yourself that make this board what it is !!!

Thanks again.

Jonny.
jonnymenthol is offline   Reply With Quote
Old 11-11-2002, 01:23 PM   #6
Newman
Québécois
 
Newman's Avatar
 
Join Date: Aug 2002
Location: Montréal
Posts: 766
Thanks: 0
Thanked 1 Time in 1 Post
Newman is on a distinguished road
Thank you for the code, it works great.
Just want to know if there is a way to mark the password with (*)
Thanks
Newman
Newman is offline   Reply With Quote
Old 11-11-2002, 01:26 PM   #7
Rob.Mills
Registered User
 
Join Date: Aug 2002
Location: Raleigh, NC USA
Posts: 871
Thanks: 0
Thanked 0 Times in 0 Posts
Rob.Mills
I was thinking about that too. What I'm considering is replacing the inputbox with a custom form and set the format of the textbox to password. Then pass that string on to the procedure. I'm thinking it shouldn't take that much modification.

ghudson, would you agree that this will work?

Rob.Mills is offline   Reply With Quote
Old 11-11-2002, 02:16 PM   #8
ghudson
Newly Registered User
 
ghudson's Avatar
 
Join Date: Jun 2002
Location: USA
Posts: 6,199
Thanks: 1
Thanked 85 Times in 49 Posts
ghudson has a spectacular aura about ghudson has a spectacular aura about ghudson has a spectacular aura about
Using a form will allow you to format the text box as a password. I never had a need to hide the password with ********* so I kept the coding simple by using an input box.

You will have to take it a step further and use real Access security once the glemlins figure out that they can import your db objects into their own db. Then they can open up "your" forms, modules, etc. from their db and see all your secrets.

__________________
.................................................. ......
Searching this forum or Microsoft.com or MSDN.com or Google is a great way to discover and learn the answers to your Access programming questions.

Well if it seems to be real, it's illusion...

I am using Access 2010 with Windows 7

The
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
function on this forum really does work.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

.................................................. ......
ghudson is offline   Reply With Quote
Old 07-27-2004, 07:32 AM   #9
Groundrush
Newly Registered User
 
Groundrush's Avatar
 
Join Date: Apr 2002
Posts: 1,376
Thanks: 12
Thanked 9 Times in 8 Posts
Groundrush is on a distinguished road
Quote:
Originally Posted by ghudson
You will have to take it a step further and use real Access security once the glemlins figure out that they can import your db objects into their own db. Then they can open up "your" forms, modules, etc. from their db and see all your secrets.
I have a solution to that problem

I just kill the B*****D....................
__________________
When people look like ants, its time to open your parachute, but when ants look like people....don't bother.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Groundrush is offline   Reply With Quote
Old 08-24-2004, 04:05 PM   #10
charlesandrews
Registered User
 
Join Date: Dec 2003
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
charlesandrews
Cool

G Hudson,

Your example of shift disable is absolute ace. I have managed to convert my database to an mde and disabled shift etc and I am quite excited that nobody can get into my data such as tables, forms etc.

The next step is to look at the security side of things, although I am a bit worried about that challenge as I have only kind of went over it briefly, but can I ask, with an MDE and the code you have provided to disable shift, is my database now fully secure?
I have also unticked allow special keys/hide database window etc and created a login form as the startup screen.
Is there any other way in which my table data, queries, forms etc can be exported?

Let's All Chant G Hudson

Last edited by charlesandrews; 08-25-2004 at 03:46 AM.
charlesandrews is offline   Reply With Quote
Old 08-25-2004, 04:41 AM   #11
Kevin_S
Registered User
 
Join Date: Apr 2002
Location: Lansing, MI
Posts: 635
Thanks: 0
Thanked 2 Times in 1 Post
Kevin_S is on a distinguished road
Charles -

No, your db is in no way secure... Here's a scary/fun trick! Create a brand new, empty db. Go to File -- Import and navigate to your mde then import all of the tables and queries!!!

Because its an mde you wont be able to get to the forms, marcos (no one but one person here really uses these anyway), and modules but the user can surely get to all of the data (the most important piece IMO)...

TO Fully secure you'll have to use Access User Level Security and cross your fingers here on this as this is a pain in the you know what... or.... do your self a favor and write the app in VB.NET! (couldn't resist a crack on Access)

HTH,
Kev
__________________
MCAD .NET
MCP VB.NET
MCP C#.NET
Kevin_S is offline   Reply With Quote
Old 08-25-2004, 09:19 AM   #12
Kevin_S
Registered User
 
Join Date: Apr 2002
Location: Lansing, MI
Posts: 635
Thanks: 0
Thanked 2 Times in 1 Post
Kevin_S is on a distinguished road
Charles -

Open a new, blank db and save it to your desktop. Next, click File -- Get External Data -- Import. The open Dialog box will open - navigate to your shift bypass, protected .mde and select it. After you select it you will now see all of the objects contained in the db!!!!! (Note* forms/macros/modules will be greyed out and unselectable in an .mde) They even make it easy for you by having a 'Select All' button. Click the tables tab and then click the select all button - ok - and PRESTO!! all of the tables are in the new, unsecure db....

Kev
__________________
MCAD .NET
MCP VB.NET
MCP C#.NET
Kevin_S is offline   Reply With Quote
Old 08-26-2004, 03:52 AM   #13
charlesandrews
Registered User
 
Join Date: Dec 2003
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
charlesandrews
Hi Kevin

Thanx for your reply again m8.

Please excuse my ignorance. Although I haven't created a new MDB on my desktop, I understand the risks with my unsecured database.
I will now start to look at security (whilst saving a backup) and hopefully explore this complexed area.

Thanx again m8.
charlesandrews is offline   Reply With Quote
Old 08-26-2004, 04:35 AM   #14
Kevin_S
Registered User
 
Join Date: Apr 2002
Location: Lansing, MI
Posts: 635
Thanks: 0
Thanked 2 Times in 1 Post
Kevin_S is on a distinguished road
No Problem Charles - wasn't trying to yell at you - just wanted you to know that what you thought was "secure" was actually not...

If your beginning to explore Access Level Security do two things first:

1 - make a backup of your database file.
2 - make a copy of the system.mdw file of which you will be modifying.

Also - you can find a complete wall-though of the steps for securing a db located on the Microsoft knowledge base website. Read these instructions, then read them again, then search this forum for keyword "user level security" - there are many posts on the subject on this forum.

If you still having problems after all of this post back to this thread and I will help you...

HTH,
Kev
__________________
MCAD .NET
MCP VB.NET
MCP C#.NET
Kevin_S is offline   Reply With Quote
Old 08-26-2004, 04:51 AM   #15
ghudson
Newly Registered User
 
ghudson's Avatar
 
Join Date: Jun 2002
Location: USA
Posts: 6,199
Thanks: 1
Thanked 85 Times in 49 Posts
ghudson has a spectacular aura about ghudson has a spectacular aura about ghudson has a spectacular aura about
Quote:
Originally Posted by Kevin_S
1 - make a backup of your database file.
2 - make a copy of the system.mdw file of which you will be modifying.
1 - Yes
2 - Yes & No ~ Do NOT alter your System.mdw file. Create a new workgroup file!

__________________
.................................................. ......
Searching this forum or Microsoft.com or MSDN.com or Google is a great way to discover and learn the answers to your Access programming questions.

Well if it seems to be real, it's illusion...

I am using Access 2010 with Windows 7

The
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
function on this forum really does work.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

.................................................. ......
ghudson is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump




All times are GMT -8. The time now is 03:16 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World