I try to set the code up like this but complier trapped stDocName with Error message "Type Mismatch"
Please Help!
-------------------------------------------------
Dim Title As String
Title = "Sango Plaza Hotel Limited"
Dim frmHiddenLogin As Form
Dim stUserName As String
Dim stLink As String
Dim stDocName As String
Dim stPassword1 As String
Dim stPassword2 As String
stUserName = Me.txtUserName
stLink = "[txtUserName] = " & "'" & stUserName & "'"
stDocName = frmHiddenLogin
DoCmd.OpenForm stDocName, , stLink, , acHidden
'Then compare the password like this:
stPassword1 = Me.txtPassword
stPassword2 = frmHiddenLogin.Password
If stPassword1 <> stPassword2 Then
MsgBox " That cannot be compute", , Title
Exit Sub
End If
Cleartext
'close form, messagebox wrong password, exit sub.
' Then check the group:
stGroup = frmHiddenLogin.Group
Select Case Departments
Reception = frmHiddenLogin.Group
Case Reception
If stPassword1 <> stPassword2 Then
MsgBox " That cannot be compute", , Title
Exit Sub
stUserName = Me.UserName
stLink = "[UserName] = " & "'" & stUserName & "'"
stDocName = frmHiddenLogin
stPassword1 = Me.Password
stPassword2 = frmHiddenLogin.Password
DoCmd.OpenForm "Reception Menu"
End If
Manager = frmHiddenLogin.Group
Case Manager
If stPassword1 <> stPassword2 Then
MsgBox " That cannot be compute", , Title
Exit Sub
stUserName = Me.UserName
stLink = "[UserName] = " & "'" & stUserName & "'"
stDocName = frmHiddenLogin
stPassword1 = Me.Password
stPassword2 = frmHiddenLogin.Password
DoCmd.OpenForm "administrative Menu"
End If
Restaurant = frmHiddenLogin.Group
Case Restaurant
If stPassword1 <> stPassword2 Then
MsgBox " That cannot be compute", , Title
Exit Sub
stUserName = Me.UserName
stLink = "[UserName] = " & "'" & stUserName & "'"
stDocName = frmHiddenLogin
stPassword1 = Me.Password
stPassword2 = frmHiddenLogin.Password
DoCmd.OpenForm "Restaurant Menu"
End If
Bar = frmHiddenLogin.Group
Case Bar
If stPassword1 <> stPassword2 Then
MsgBox " That cannot be compute", , Title
Exit Sub
stUserName = Me.UserName
stLink = "[UserName] = " & "'" & stUserName & "'"
stDocName = frmHiddenLogin
stPassword1 = Me.Password
stPassword2 = frmHiddenLogin.Password
DoCmd.OpenForm "Bar Menu"
End If
Else
MsgBox "You have are unauthorized user", , Title
End Sub
Matthew Ikechukwu
Email:
[email protected]