Private Sub Command9_Click()
'Used as a where clause
Dim lSearch As String
'Build the criteria to limit the row where servername and passcode match
lSearch = "[ServerName]='" & Me.txtServerName & "' AND [Passcode] = '" & Me.txtPasscode & "'"
'check user should be able to access system
If Me.ServerName = Me.txtServerName And Me.Passcode = Me.txtPasscode Then
' Using DLookup we find the ServerID in tblServer and meets the where/criteria clause
' We then set the global variable gblServerID
gblServerID = DLookup("[ServerID]", "tblServer", l_search)
'Close login form
DoCmd.Close
'Open Main Form
DoCmd.OpenForm "frmMainMenu"
Else
'Inform the user they have not been successful
MsgBox "Password incorrect or required"
End If
End Sub