DoCmd.SetWarnings False
Dim oNet, ocomp As Object
Set oNet = CreateObject("WScript.Network")
Set ocomp = CreateObject("WScript.Network")
UserName = oNet.UserName
computername = ocomp.computername
If (IsNull(DLast("[LoggedOut]", "Usage", "[UserName] ='" & Me.UserName & "'"))) Then
If MsgBox("Please remember to close the BDatabase using the 'Exit' button" & Chr(13) & Chr(10) & "Thank you for your co-operation.", vbInformation, "Info") = vbOK Then
End If
End If
DoCmd.OpenQuery "qryUpdateUsage", acViewNormal
If (IsNull(DLookup("[Name]", "BDUsers", "[Login ID] ='" & Me.UserName & "'"))) Then
Me.Caption = "UNKNOWN USER - Welcome to the BDatabase"
Me.security = 777
Else
Me.Caption = DLookup("[Name]", "BPDUsers", "[Login ID] ='" & Me.UserName & "'") & " - Welcome to the BP Database"
Me.security = DLookup("[Security]", "BDUsers", "[Login ID] ='" & Me.UserName & "'")
End If
DoCmd.SetWarnings False
Dim db As DAO.Database
Dim snp As DAO.Recordset
Dim msg As String
Set db = CurrentDb
Set snp = db.OpenRecordset("Settings", dbOpenSnapshot)
If snp![Logoff] Then
If Me.security = 999 Then
MsgBox "Welcome Admin", vbOKOnly, "You're in!"
Else
msg = "The database is currently closed for updating" & vbCrLf & vbCrLf & vbTab & _
"Please try later." & vbCrLf & vbTab & "Thank you." & vbCrLf & "Matthew King" & vbCrLf & "(7100 5034)"
MsgBox msg
Application.Quit
End If
End If
Me.frmNotification_Count.Visible = security
Me.frmOutstandingCount.Visible = security
Me.cmdMaint.Visible = security
Me.cmdRefresh.Visible = security
DoCmd.Hourglass False
DoCmd.SetWarnings True