MsgBox "USER DNS DOMAIN = " & Environ("USERDNSDOMAIN") & " " & "USERNAME = " & LCase(Environ("USERNAME"))
Usrname = LCase(Environ("USERNAME"))
USERDNSNAME = Environ("USERDNSDOMAIN")
Usrname = "jbritt"
USERDNSNAME = "ENT.COVANCE.COM"
'If the USERDNSNAME (Domain) is equal to "ENT.COVANCE.COM" switch OPRID to a Labcorp PeopleSoft OPRID from the XREF table
If USERDNSNAME = "ENT.COVANCE.COM" Then
Set PSData = CreateObject("ADODB.Recordset")
RUNSQL = "SELECT DISTINCT O.OPRID FROM SYSADM.PS_LCA_MACRO_XREF O WHERE O.USERID = '" & Usrname & "'"
RowCount = 0
With PSData
.Open Source:=RUNSQL, ActiveConnection:=PSConnection, CursorType:=3 'adOpenStatic
RowCount = PSData.RecordCount
Oprid = Oprid
.Close
End With
Set PSData = Nothing
If RowCount <> 1 Then
PSConnection.Close
Set PSConnection = Nothing
msg = "Error: You do not have a login ID that is set up in Diagnostics PeopleSoft"
response = MsgBox(msg, 16, title)
Exit Sub
End If
End If