Results 1 to 3 of 3
  1. #1
    KenThompson is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2011
    Posts
    11

    1 New User Gets Errors Populating Control Of New Form On Form_load

    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

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Doubt will make any difference but why use an alias name for the pkID in the query? Also, I refer to recordset fields with ! (bang): rsTemp!pkID

    New user - maybe network permissions are interfering with saving data?

    I am not familiar with how you got messages to show in 'Me'. Where is this?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    KenThompson is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2011
    Posts
    11
    Quote Originally Posted by June7 View Post
    New user - maybe network permissions are interfering with saving data?

    I am not familiar with how you got messages to show in 'Me'. Where is this?
    I am thinking this is a network access problem, working on getting that resolved. As far as the contents of "Me."... When stopped on a breakpoint open the "Locals Window". The first item in the list is Me and if you expand it you see the list of properties. Those error message I noted were values in those properties. I have no reason to think those values were in direct relation to the problem, I just didn't know.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Populating a combo box with a Calendar Control
    By system243trd in forum Access
    Replies: 0
    Last Post: 12-02-2011, 04:22 AM
  2. Form_Load Event
    By Juan4412 in forum Programming
    Replies: 4
    Last Post: 07-12-2011, 04:12 PM
  3. Form_Load not being called
    By Buakaw in forum Forms
    Replies: 1
    Last Post: 03-09-2011, 04:46 AM
  4. Form_Load Events
    By TheDeceived in forum Programming
    Replies: 1
    Last Post: 09-20-2010, 12:19 PM
  5. Replies: 0
    Last Post: 03-22-2010, 07:51 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums