M
Muriukis
Thanks Daniels for your answer but am yet to be satisfied.The form login is
unbound and it has two textboxes UserName and Password.What I have done is
set the password in code below
Dim a As Integer
Dim b As String
Dim c As String
Dim d As Integer
Dim e As String
Dim f As Integer
a = "2008"
b = "Admin"
c = "User1"
d = "2007"
e = "User2"
f = "2004"
If UserName = b And Password = a Then
stDocName = "Switchboard1"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "Login"
ElseIf UserName = c And Password = d Then
stDocName = "Switchboard2"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "Login"
ElseIf UserName = e And Password = f Then
stDocName = "Switchboard2"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "Login"
Else
MsgBox "Invalid Password, try again!", , "ACCESS DENIED"
Password.SetFocus
End If
End Sub
Now how do I get the login UserName to show in a required text box in
another form in the program
NB its a point of sale and I have not used the access security wizard
anywhere and dont plan to
Any help because when I use the getuser function below am getting my name as
I am the admin of my computer
Public Function GetUser() As String
'return currently logged in user
Dim db As New Application
GetUser = db.CurrentUser
End Function
Where am I going wrong any help or advise is really appreciated
unbound and it has two textboxes UserName and Password.What I have done is
set the password in code below
Dim a As Integer
Dim b As String
Dim c As String
Dim d As Integer
Dim e As String
Dim f As Integer
a = "2008"
b = "Admin"
c = "User1"
d = "2007"
e = "User2"
f = "2004"
If UserName = b And Password = a Then
stDocName = "Switchboard1"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "Login"
ElseIf UserName = c And Password = d Then
stDocName = "Switchboard2"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "Login"
ElseIf UserName = e And Password = f Then
stDocName = "Switchboard2"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "Login"
Else
MsgBox "Invalid Password, try again!", , "ACCESS DENIED"
Password.SetFocus
End If
End Sub
Now how do I get the login UserName to show in a required text box in
another form in the program
NB its a point of sale and I have not used the access security wizard
anywhere and dont plan to
Any help because when I use the getuser function below am getting my name as
I am the admin of my computer
Public Function GetUser() As String
'return currently logged in user
Dim db As New Application
GetUser = db.CurrentUser
End Function
Where am I going wrong any help or advise is really appreciated