Login/VBA script to login to Access 2000
- From: "cyndithomas via AccessMonster.com" <u31571@uwe>
- Date: Wed, 21 Mar 2007 17:50:37 GMT
I new to Visual Basic and am struck on a issue. Have created a Login in
Screen for Remote User to access and input data. Want the Remote to be able
to login & access the Input Form, and Manager to Login to another screen to
view data.
Form 1 is rmFieldReq (Remote Users Form)
Form 2 is frmREquests (Manager Form)
Below is my Code
Private Sub cmdCancel_Click()
DoCmd.SetWarnings False
DoCmd.RunSQL "SELECT '' AS LoggedInAccess INTO access"
DoCmd.SetWarnings True
DoCmd.Quit acQuitSaveAll
End Sub
Private Sub cmdOK_Click()
DoCmd.SetWarnings False
'Check to see if they are a valid user
If DCount("[user]", "tblUser", "[user] = '" & txtUser & "'") = 0 Then
MsgBox "Get Away"
DoCmd.RunSQL "SELECT '' AS LoggedInAccess INTO access"
Exit Sub
End If
'Check password
Dim tempPass
tempPass = DLookup("[password]", "tblUSer", "[user] = '" & txtUser & "'")
If IsNull(txtPassword) Or txtPassword <> tempPass Then
MsgBox "Wrong Password"
DoCmd.RunSQL "SELECT '' AS LoggedInAccess INTO access"
Exit Sub
End If
'Write Field Office Name (access) in access Table
Dim FO
FO = DLookup("[FOID]", "tblUSer", "[user] = '" & txtUser & "'")
DoCmd.RunSQL "SELECT '" & FO & "' AS LoggedInAccess INTO access"
'Write Username (access) in access Table
Dim User
User = DLookup("[GROUPID]", "tblUSer", "[user] = '" & txtUser & "'")
If (GroupID) = requests Then
DoCmd.RunSQL "SELECT '" & GROUP & "' AS LoggedInAccess INTO access"
DoCmd.Close acForm, "frmLogin"
DoCmd.OpenForm "Requests", acNormal
Else
FO = DLookup("[FOID]", "tblUSer", "[user] = '" & txtUser & "'")
If IsNull(FOID) = FO Then
DoCmd.Close acForm, "frmLogin"
DoCmd.OpenForm "frmFieldReq"
'Test it
DoCmd.Close acForm, "frmLogin"
DoCmd.OpenForm "frmFieldReq"
'DoCmd.OpenQuery "qryPOEs"'
DoCmd.SetWarnings True
End Sub
thank you
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/databases-ms-access/200703/1
.
- Follow-Ups:
- Re: Login/VBA script to login to Access 2000
- From: storrboy
- Re: Login/VBA script to login to Access 2000
- From: storrboy
- Re: Login/VBA script to login to Access 2000
- Prev by Date: Re: Center Overlapping Controls
- Next by Date: Re: Center Overlapping Controls
- Previous by thread: Access "Pages": Anybody Found A Real-World Use?
- Next by thread: Re: Login/VBA script to login to Access 2000
- Index(es):
Relevant Pages
|