Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

automatically insert a users network username in to a field

Discussion in 'Information Technology' started by Dax, Oct 27, 2005.

  1. Dax

    Dax
    Expand Collapse
    Guest

    I have a database and I would like to add a feild that automaticly inserts a
    users network Id (username) in to the feild so that I can keep track of who
    put what in at what time.
     
  2. '69 Camaro

    '69 Camaro
    Expand Collapse
    Guest

    Please see the following Web page for the VBA code to get the current user's
    login name:

    http://www.mvps.org/access/api/api0008.htm

    HTH.
    Gunny

    See http://www.QBuilt.com for all your database needs.
    See http://www.Access.QBuilt.com for Microsoft Access tips.

    (Please remove ZERO_SPAM from my reply E-mail address so that a message will
    be forwarded to me.)
    - - -
    If my answer has helped you, please sign in and answer yes to the question
    "Did this post answer your question?" at the bottom of the message, which
    adds your question and the answers to the database of answers. Remember that
    questions answered the quickest are often from those who have a history of
    rewarding the contributors who have taken the time to answer questions
    correctly.


    "Dax" wrote:

    > I have a database and I would like to add a feild that automaticly inserts a
    > users network Id (username) in to the feild so that I can keep track of who
    > put what in at what time.
     
  3. Douglas J Steele

    Douglas J Steele
    Expand Collapse
    Guest

    Gunny's shown you how you can determine the current user's ID.

    I wanted to find out more about your needs, though.

    If you're hoping to be able to set this as a default field in a table, I'm
    afraid you're out of luck. You can use that function to populate a field
    through a form (or through a query that's run from within Access), but you
    cannot use UDFs (user-defined functions) as default values for table fields.

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no e-mails, please!)


    "Dax" <Dax@discussions.microsoft.com> wrote in message
    news:2DA1D995-4F1A-4089-9A28-CE483B4625A0@microsoft.com...
    > I have a database and I would like to add a feild that automaticly inserts

    a
    > users network Id (username) in to the feild so that I can keep track of

    who
    > put what in at what time.
     
  4. Albert D.Kallal

    Albert D.Kallal
    Expand Collapse
    Guest

    > but you
    > cannot use UDFs (user-defined functions) as default values for table
    > fields.



    Yes, and I will add my 2 cents:

    You *can* use a UDF for a default on a control on a form. And, since we
    don't edit tables directly..then this is not such a problem....


    --
    Albert D. Kallal (Access MVP)
    Edmonton, Alberta Canada
    pleaseNOOSpamKallal@msn.com
    http://www.members.shaw.ca/AlbertKallal
     

Share This Page