I have a new user for my database and he's getting an error I can't understand. I have a menu form that opens fine, upon clicking the button to load a new record form he gets an error none of my current users (60ish people) get.
the Form_Load code for the form is:
Code:
Private Sub Form_Load()
Dim strUser As String
Dim rsTemp As New ADODB.Recordset
'get system userID for 'Entered By' field
strUser = Environ("USERNAME")
rsTemp.Open "SELECT [pkID] as theID FROM tblEmployee Where [txtLanID] ='" & strUser & "';", _
CurrentProject.Connection, adOpenStatic, adLockReadOnly
If rsTemp.RecordCount <> 0 Then
Me.cntrlEnteredBy = rsTemp("theID")
Else
MsgBox strUser & " cannot be found in Employee Table. Either there is no record for you in the Installation Plan Employee Table or there is an error. Please See DB Admin to have your Employee Record Updated."
DoCmd.Close acForm, "New Plan", acSaveNo
End If
rsTemp.Close
End Sub
It errors on the line
Code:
Me.cntrlEnteredBy = rsTemp("theID")
If I hard code his userid, replacing strUser = Environ("USERNAME") with strUser = "hisID" on my machine everything seems to work fine. So, I'm guessing it's a problem with his machine?
On the interface, in the message bar, when it errors it says "cannot update recordset". With the code editor up the errors show in "Me" as follows:
Me.acHiddenCurrentPage = You entered an expression that has an invalid referenceto the property acHiddenCurrentPage
Me.ActiveControl = The expression you entered requires the control to be in the active window
Me.AfterBeginTransaction = You entered an expression that has an invalid referenceto the property AfterBeginTransaction
Me.AfterBeginTransactionMacro = You entered an expression that has an invalid referenceto the property AfterBeginTransaction
Me.AfterCommitTransaction = You entered an expression that has an invalid referenceto the property AfterCommitTransaction
Me.AfterCommitTransactionMacro = You entered an expression that has an invalid referenceto the property AfterCommitTransactionMacro
rsTemp.Fields.Item1.Name = "theID"
rsTemp.Fields.Item1.Value = the correct Employee ID for the user
So, that seems kosher...
Any ideas about what might be causing this problem?
Thanks,
Ken