Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2013

    Unanswered: User ID Based On Network LogOn


    I am updating an existing database in MS Access 2010 from MS Access 97. The creator of the original database is no longer in our section and it was determined it would be easier to recreate the database instead of trying to figure out how to hand over “Admin” responsibilities.

    In the MS Access 97 DB there is a button that will assign a supplier/record to the current user. This button is run off a macro that I have duplicated in the MS Access 2010 DB. All that is stored in the table is the last 5 digits of the users Network Log In. The macro is as follows:

    Name: mcrAssignSupplierToMe
    SetValue: Item = [Forms]![frmSupplierData]![Assigned To] Expression = Right(CurrentUser(),5)

    When the button is clicked on from the form, I get a pop-up message that says, “:The value you entered isn’t valid for this field” followed by a Macro Single Step window with the following:

    Macro Name: mcrAssignSupplierToMe
    Action: SetValue
    Arguments: [Forms]![frmSupplierData]![Assigned To], Right(CurrentUser(),5)
    Error Number: 2113

    How do I get MS Access 2010 to look at the user’s log in to the Network and store the last 5 digits of their log in ID?

    Any help anyone can provide would be very much appreciated.


  2. #2
    Join Date
    Mar 2009
    Provided Answers: 15
    See: API: Get Login name. That's precisely what you're looking for.
    Have a nice day!

  3. #3
    Join Date
    Feb 2013
    Hello Sinndho,

    Thank you for the VBA code. I have put the code into my DB as fOSUserName but I do not know how to reference it in my Macro. I have a long Macro that does a SetValue on a field for the user's badge number. I tried referencing the fOSUserName but gets an error saying the expression entered has a function name the DB can't find.

    I don't know VBA (that's why everything is in Macros) so I do not know if I need to change anything in the code to match something in my DB.

    Any additional assistance you can provide would be appreciated.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts