Custom LogOn Form

  • Thread starter Thread starter Dom
  • Start date Start date
D

Dom

Hello Everyone,

I hope someone can help me. I'm currently a self-
tought beginner stepping to intermedia in access
programming. I have created several databases with custom
logOn forms (with help of samples of course). I have the
main database with the forms and the tables are linked
from several other databases. The thing that I'm feeling a
little uncomfortable with is the fact that in order to
logIn into the main database with the forms obviously you
need a password; however, the other databases where the
tables reside are open to any user, which I see that as a
potential problem since the information that is contained
is highly confidential and should not be browsed by just
anyone. My question goes as follow: Is there anyway that I
can place a password to the other databases where the
tables are located (5) but without the user being prompted
if they are entering the database from the main interface ?
If the above made any sence please guide me in the
right direction. Thanks in advace everyone.

Dominick
 
Dominick,
The first thing I suggest you do is go to
http://support.microsoft.com/default.aspx?scid=kb;en-
us;207793&Product=acc2000 (copy all of this URL to your
browser address window)
and download the security FAQ and read it thoroughly -
don't "browse" or skim read it - you will miss something
for sure, and secure all your db's setting user
permissions as required.
Then you can create one simple db for logging in and all
you would have in it is a form. I use option buttons in
an option group for selecting the db the user wants to
log into, but you could go any number of routes there.
Then you create a login button and a cancel button which
will run the following code:

Private Sub cmdCancel_Click()
On Error GoTo Err_cmdCancel_Click


DoCmd.Quit

Exit_cmdCancel_Click:
Exit Sub

Err_cmdCancel_Click:
MsgBox Err.Description
Resume Exit_cmdCancel_Click

End Sub

Private Sub cmdLogIn_Click()
Dim strPath As String
Dim strDbPath As String

Select Case grpWhichDB

Case 1
strDbPath = "Path to Whatever Db"

Case 2
strDbPath = "Path to Whatever Db"

Case 3
strDbPath = "Path to Whatever Db"

'You get the idea

Case Else
MsgBox ("You did not select a databse to open." &
vbCr _
& "Please do so now."),
vbExclamation, "Must Select Database"
Exit Sub

End Select

If IsNull(txtUser) Then
MsgBox ("You did not enter your username." & vbCr _
& "Please do so now."), vbExclamation, "No
Username"
Me.txtUser.SetFocus
Exit Sub
ElseIf IsNull(txtPass) Then
MsgBox ("You did not enter your password." & vbCr _
& "Please do so now."), vbExclamation, "No
password"
Me.txtPass.SetFocus
Exit Sub
End If



strPath = Chr(34) & "C:\Program Files\Microsoft
Office\Office10\MSACCESS.EXE - Or wherever your
Access.EXE files exists" & Chr(34) & " " _
& Chr(34) & strDbPath & Chr(34) & " " _
& "/wrkgrp " & Chr(34) & "Path to MDW file" & Chr
(34) & " " _
& "/User " & Chr(34) & Me![txtUser] & Chr(34) & " "
_
& "/Pwd " & Chr(34) & Me![txtPass] & Chr(34)

Debug.Print strPath ' Uncomment this line to have
the strPath variable displayed in the immediate window

Shell strPath, vbMaximizedFocus
Application.Quit
End Sub

BE SURE that when you creat the text box for the password
you set its input mask property to "password" so it will
display asterisks instead of the actual password (in case
big brother is watching!)

HTH - and I hope I didn't forget anything :)
Tom
 
To be honest with you some of what you have mentioned made
sense and some didn't, evidently I'm more of a beginner
than I thought.
In your example it seems that I've might of not explained
my self correctly. The other 5 databases simply hold the
tables which have been already linked. All those 5
databases are relevant to one another. I just simply used
5 separate databases to be able to imput more info in the
future. I was hoping to be able to use something like the
send keys command or something to that effect. But I will
read the article thoroughly as you have suggested and may
be understand the answer. I appreciate your quick response
and thank you very much for pointing me into the right
direction.

Best regards,
Dominick.
-----Original Message-----
Dominick,
The first thing I suggest you do is go to
http://support.microsoft.com/default.aspx?scid=kb;en-
us;207793&Product=acc2000 (copy all of this URL to your
browser address window)
and download the security FAQ and read it thoroughly -
don't "browse" or skim read it - you will miss something
for sure, and secure all your db's setting user
permissions as required.
Then you can create one simple db for logging in and all
you would have in it is a form. I use option buttons in
an option group for selecting the db the user wants to
log into, but you could go any number of routes there.
Then you create a login button and a cancel button which
will run the following code:

Private Sub cmdCancel_Click()
On Error GoTo Err_cmdCancel_Click


DoCmd.Quit

Exit_cmdCancel_Click:
Exit Sub

Err_cmdCancel_Click:
MsgBox Err.Description
Resume Exit_cmdCancel_Click

End Sub

Private Sub cmdLogIn_Click()
Dim strPath As String
Dim strDbPath As String

Select Case grpWhichDB

Case 1
strDbPath = "Path to Whatever Db"

Case 2
strDbPath = "Path to Whatever Db"

Case 3
strDbPath = "Path to Whatever Db"

'You get the idea

Case Else
MsgBox ("You did not select a databse to open." &
vbCr _
& "Please do so now."),
vbExclamation, "Must Select Database"
Exit Sub

End Select

If IsNull(txtUser) Then
MsgBox ("You did not enter your username." & vbCr _
& "Please do so now."), vbExclamation, "No
Username"
Me.txtUser.SetFocus
Exit Sub
ElseIf IsNull(txtPass) Then
MsgBox ("You did not enter your password." & vbCr _
& "Please do so now."), vbExclamation, "No
password"
Me.txtPass.SetFocus
Exit Sub
End If



strPath = Chr(34) & "C:\Program Files\Microsoft
Office\Office10\MSACCESS.EXE - Or wherever your
Access.EXE files exists" & Chr(34) & " " _
& Chr(34) & strDbPath & Chr(34) & " " _
& "/wrkgrp " & Chr(34) & "Path to MDW file" & Chr
(34) & " " _
& "/User " & Chr(34) & Me![txtUser] & Chr(34) & " "
_
& "/Pwd " & Chr(34) & Me![txtPass] & Chr(34)

Debug.Print strPath ' Uncomment this line to have
the strPath variable displayed in the immediate window

Shell strPath, vbMaximizedFocus
Application.Quit
End Sub

BE SURE that when you creat the text box for the password
you set its input mask property to "password" so it will
display asterisks instead of the actual password (in case
big brother is watching!)

HTH - and I hope I didn't forget anything :)
Tom
-----Original Message-----
Hello Everyone,

I hope someone can help me. I'm currently a self-
tought beginner stepping to intermedia in access
programming. I have created several databases with custom
logOn forms (with help of samples of course). I have the
main database with the forms and the tables are linked
from several other databases. The thing that I'm feeling a
little uncomfortable with is the fact that in order to
logIn into the main database with the forms obviously you
need a password; however, the other databases where the
tables reside are open to any user, which I see that as a
potential problem since the information that is contained
is highly confidential and should not be browsed by just
anyone. My question goes as follow: Is there anyway that I
can place a password to the other databases where the
tables are located (5) but without the user being prompted
if they are entering the database from the main interface ?
If the above made any sence please guide me in the
right direction. Thanks in advace everyone.

Dominick
.
.
 
Back
Top