This is going to be a long answer with lots of code but it works because I have a database that does the exact thing you are trying to do.
First,
You can try to fix your own code...looks like the DLookup function needs a few more symbols.
try this:::::::: [Forms]![Splash]![txtUser] = DLookUp("[User ID]","[Analysts]","[User ID]='" & [Forms]![Splash]![txtUser] & "'")
If that doesn't work or you want a better approach....read below at your own risk.
Place the following code in a new module.
Option Explicit
Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function getTheUser() As String
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String
strUserName = String$(254, 0)
lngLen = 255
lngX = apiGetUserName(strUserName, lngLen)
If (lngX > 0) Then
getTheUser = Left$(strUserName, lngLen - 1)
Else
getTheUser = vbNullString
End If
End Function
I decided to build a class that will do all of the dirty work to find access levels, names, and empID's whenever the class is referenced. It cleans up the code on your main form by locating it to a different module.
Create a new class called UserClass....then paste the code below.
I use the dlookup function to pull names and id's out of tables.
Option Explicit
Dim userFirst As String
Dim userLast As String
Dim userID As String
Dim PositionID As String
Sub getInfo(ByVal uname As String)
'set the userID as the passed variable uname
userID = uname
'for empID use DLookup
PositionID = DLookup("[ID]", "ExcelList", "[EmployeeM2] = '" & uname & "'")
End Sub
'Then you need to set some properties for your class so you can reference them later.
Public Property Get PosID() as String
PosID = PositionID
End Property
Now, in your mainform you can reference your class
'this should be declared at the top with the global declarations
Public newuser As UserClass
'this is the final piece of code that finds the username
'instantiate the class
Set newuser = New UserClass
'use the getTheUser function to return the windows logon id
'run the main class procedure to find all the required info.
newuser.getInfo (getTheUser)
then to find the right form just use your property.
If newuser.PosID = "someusername" then
docmd.openform "this form"
End If
Its not the most simple way to go about linking usernames up with forms but it runs clean and is easily reusable.