User Login start up form

G

Guest

Hi Guys
I want to create a user login form for my Database, one that appears before
the database opens and users have to sign in with their username being their
country and then they have to put in passwords. I have a table in the database
tblCountry_Passwords which has fields CountryId, Country, Password. I want
the countries to be a drop down list on the form. If someone does not enter a
password and tries to login there must be a "enter password" message. If
someone enters wrong password 3 times then the database should log them out.
The country is sort of the username. Only one person in each country would
have access to this database which will be on global server. So the person in
Argentina needs to type Argentina as username and then password as a Person
in Jamaica will type Jamaica and their password.
I am not a programmer so please help me.
Thank you
 
D

darren via AccessMonster.com

Nit perhaps the best way, or the way I would do it. You should at least
consider workgroup security. But since you asked:

On the form have a combobox for the countrys 'cboCountry' with the CountryID
in the first column hidden and bound and the country in the second visible
column.Then an unbound text box 'txtPassword' with the follow for the after
update event

Public LogonError As Integer

Private Sub txtPassword_AfterUpdate()
On Error GoTo txtPassword_AfterUpdate_Err

Dim strPass as string

strPass = dlookup("[Password]","tblCountry_Passwords","[CountryID= " & Me.
cboCountryID & "")

'Check password entered
If Me.txtPassword.Value = strPass Then ' If valid
' Do something here
DoCmd.Close acForm, Me.Name
Else
' If not valid
LogonError = LogonError + 1
' Log number of attempts

If LogonError = 3 Then
' If number of attempts is 3 then boot user off application
MsgBox "You have exceeded the allowed number of Logon tries." &
vbCrLf & vbCrLf & "The Database will now close."
DoCmd.Quit
Else
MsgBox "Invalid Password. Please re-enter."
End If

End If


txtPassword_AfterUpdate_Exit:
Exit Sub

txtPassword_AfterUpdate_Err:
MsgBox Error$
Resume txtPassword_AfterUpdate_Exit

End Sub

Percy wrote:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top