Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Log in Form

Status
Not open for further replies.

cmmd2003

Programmer
Mar 23, 2007
28
GB
I need some help creating a basic log in form, which will allow access to the rest of the database.

I have no idea where to start. Help would be appreciated.

Thankyou for your time
 
How are ya cmmd2003 . . .

Following are several options:
[ol][li]Assign a [blue]single password[/blue] to the Db ( MenuBar-Tools-Security-Set Database Password ). All users use the same password.[/li]
[li]Use Access [blue]User Level Security[/blue] ( MenuBar-Tools-Security-User Level Security Wizard). Users enter a Name & Password. This is the highest security offered by access and is the most complex to setup! . . . certainly not for the faint of heart! . . . but doable![/li]
[li]Your own [blue]Custom Security[/blue] involving the following:
[ol a][li]An independent table of [blue]Screen Names[/blue][/li]
[li]A form with one field, based on the table above, run by the [blue]AutoExec Macro[/blue], having a [blue]password input filter[/blue] to block view of the actual characters typed.[/li][/ol][/li][/ol]

Just a first shot at this.

[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
What is an AutoExMacro, and when do i store the passwords?
 
cmmd2003
cmmd2003 said:
[blue]What is an AutoExMacro . . .[/blue]
An [blue]AutoExec[/blue] macro is a macro that automatically runs when you first open the Db. Its constructed in the [blue]Macros[/blue] window, and would start your [blue]custom login form.[/blue]
cmmd2003 said:
[blue] . . . , and when do I store the passwords?[/blue]
You can [blue]store the passwords directly[/blue] in the table or thru some type of [blue]Registration Form.[/blue]

[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Ok thanks. Now ive done that what code do i need to add to link these tables.
 
cmmd2003 said:
[blue]Now ive done that what code do i need to add to link these tables.[/blue]
You don't say which part you completed, then you immediately ask for code! [surprise]

You need to:
[ol][li]Construct you password table.[/li]
[li]Construct your login form.[/li]
[li]Construct the [blue]AutoExec[/blue] macro to open your login form.[/li]
[li]Write code in your login form to verify passwords.

As far as any code is concerned, [purple]let me know what you've tried.[/purple][/li][/ol]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
I've added the tables for the username and password, created a form, and have constructed the AutoExec Macro.

I haven't tried any code because i dont know where to start at all. Ive got as far as

Private Sub Login_Click()
 
You keep saying table[red]s[/red], plural. There is only one independent table (no relationships) comprising UserName & Password.

In the Login form you need to:
[ol][li]Validate the password entered. You can use [blue]DLookUp[/blue] for this.[/li]
[li]If validation passes, proceed to opening the next form or whatever else you want to do.[/li]
[li]If validation fails, clear the password textbox and set focus there, ready for another try.[/li][/ol]
The main idea is deciding how you want to handle validation, and that is up to you.

BTW: At present, [blue]passwords are not case sensitive.[/blue]

Your Thoughts? . . .

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Ok ive sorted out the table, and hav attempted a DLookUp function:

How does the DLookUp work. I've only used this function to return a value from specified records.

Sorry if i am annoyance.
Thankyou for all of your time
 
Ok i've made some positive progress. The tests ive done have worked succesfully using the code

Private Sub Command6_Click()
Dim pswd As Variant
pswd = DLookup("[Password]", "[LogInDet]", "[Lname]=Form![LogIn]")
If [Password] = [pswd] Then
[Don't know what to write here]
End If
End Sub

This form will open up on start up, and if the details are correct i need it to load up the switchboard that i will be using.

Also when the form is up, i need to prevent the rest of the database being accessed.


 
In the Tools/Startup/"display form/page" put the name of your login form.

Private Sub Command6_Click()
Dim pswd As Variant
pswd = DLookup("[Password]", "[LogInDet]", "[Lname]=Form![LogIn]")
If [Password] = [pswd] Then
docmd.openform "nameofswitchboardform"
End If
docmd.close
End Sub

Ian Mayor (UK)
Program Error
Always make your words short and sweet. Because you never know when you may have to eat them.
 
Forgot to mention, if you are opening the switchboard with the autoexec macro remove the open form command


Ian Mayor (UK)
Program Error
Always make your words short and sweet. Because you never know when you may have to eat them.
 
Thanks for your help.
Can you give me a heads up on how to disable the rest of the database, until the correct password has been entered
 
Backup you DB first!

Turn off the 'display database window','allow full menus' and 'use access special keys' options in the startup options form.

You could even change it to a standalone DB which doesn't require the user to have access installed.

These are minimal security techniques and there have been many a discussion about this subject in these forums. Try searching for 'security'.



Ian Mayor (UK)
Program Error
Always make your words short and sweet. Because you never know when you may have to eat them.
 
cmmd2003 . . .

Sorry to get back so late.

I'm back at the code you gave for validating the password. Your using [blue]Lname[/blue] to determine if a password exist without validating the password itself. [blue]It doesn't matter what the pasword is[/blue], [red]it just has to exist![/red] . . . See my point! You need to validate both [blue]Lname[/blue] and [blue]Password[/blue].

The following is an example of how to do this and keep the user on the login form until they enter the proper pass data.

Note: the code assumes textboxes for [blue]LogIn[/blue] and [blue]Password[/blue] reside on the form:
Code:
[blue]Private Sub Command6_Click()
   Dim Msg As String, Style As Integer, Title As String
   Dim DL As String, Cri As String
   
   DL = vbNewLine & vbNewLine
   Cri = "[Lname] = '" & Me!LogIn & "' AND " & _
         "[Password] = '" & Me!Password & "'"
   
   If IsNull(DLookup("[Password]", "[LogInDet]", Cri)) Then
      Msg = "LastName and/or Password Not Found!" & DL & _
            "You'll have to try again . . ."
      Style = vbCritical + vbOKOnly
      Title = "Login Error! . . ."
      MsgBox Msg, Style, Title
      Me!Password = ""
      Me!LogIn = ""
      Me!LogIn.SetFocus
   Else
      DoCmd.OpenForm "[purple][b][i]SwitchBoardName[/i][/b][/purple]"
   End If

End Sub[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Is there a way i can hide the password e.g. make asteriks appear
 
cmmd2003 . . .

In the [blue]Input Mask[/blue] property of the textbox to receive the password, enter [purple]Password[/purple]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top