current user

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kay

    current user

    Hi Guys

    I have created a single database that resides on one computer. The
    database has about 11 users which I have created using the ms access
    security feature so that each user has to login with their own name and
    password.

    In my table I have a field called user which is represented by a text
    box on my form. When storing a record I want to display the user who
    first stored that particular record. I am using access 2000 and the
    currentuser() in the text box does not seem to work

    Any help will be appreciated

  • Larry Linson

    #2
    Re: current user

    A Field defined in the Record with =CurrentUser() as its Default Value has
    worked for me. That is only updated when the record is created... it won't
    be "user who last updated".

    What do you mean "the currentuser() in the textbox"? If you clarify, someone
    may be able to make a useful suggestion.

    Larry Linson
    Microsoft Access MVP



    "Kay" <khal_786@hotma il.com> wrote in message
    news:1142459232 .470357.149770@ z34g2000cwc.goo glegroups.com.. .[color=blue]
    > Hi Guys
    >
    > I have created a single database that resides on one computer. The
    > database has about 11 users which I have created using the ms access
    > security feature so that each user has to login with their own name and
    > password.
    >
    > In my table I have a field called user which is represented by a text
    > box on my form. When storing a record I want to display the user who
    > first stored that particular record. I am using access 2000 and the
    > currentuser() in the text box does not seem to work
    >
    > Any help will be appreciated
    >[/color]


    Comment

    • Anthony England

      #3
      Re: current user

      "Kay" <khal_786@hotma il.com> wrote in message
      news:1142459232 .470357.149770@ z34g2000cwc.goo glegroups.com.. .[color=blue]
      > Hi Guys
      >
      > I have created a single database that resides on one computer. The
      > database has about 11 users which I have created using the ms access
      > security feature so that each user has to login with their own name and
      > password.
      >
      > In my table I have a field called user which is represented by a text
      > box on my form. When storing a record I want to display the user who
      > first stored that particular record. I am using access 2000 and the
      > currentuser() in the text box does not seem to work
      >
      > Any help will be appreciated[/color]


      You should be able to put
      =CurrentUser()
      in the Default Value property of the textbox.


      Comment

      • Kay

        #4
        Re: current user

        Im going to mess about with it a bit furthur but what I meant was I
        entered currentuser() in the control source property of the text box

        Comment

        • Kay

          #5
          Re: current user

          Guys, Ivetried that but it works for an unbound field only. On a bound
          field it comes up as 0

          Any suggestions please

          Comment

          • DeanL

            #6
            Re: current user

            I had a problem similar to this using CurrentUser() and for some
            reason, the text boxes just would not update after the relevant field
            was updated so I used:

            AfterUpdate

            txtBox = CurrentUser

            minus the brackets and I've never had a problem since then. I found
            the reason for this was that the DB didn't like updating the textbox
            when another control was the focus for the AfterUpdate event and this
            was pointed out to me in ths group. Hope this helps

            Comment

            • Kay

              #7
              Re: current user

              Thanks dean, but this will update the field continuously but I need to
              store the name of the user who saved that particular record. If another
              user logs in and saves another record, I want to have the other users
              name stored in the user field for the other record

              Comment

              • DeanL

                #8
                Re: current user

                Sorry Kay,

                I created a User field in the relevant table and used the above process
                to record who made changes against a particular record. I display this
                on the form using a text box and by storing the Username in a field the
                CurrentUser function applies only to the specific record that the user
                is updating/changing.

                Hope I haven't confused you on this (as I usually end up confusing
                myself).

                D...

                Comment

                • Kay

                  #9
                  Re: current user

                  Crystal Clear, Thanks alot dean Im just gona start playing about with
                  it for a moment and hope to get it working,

                  Comment

                  • Anthony England

                    #10
                    Re: current user

                    "Kay" <khal_786@hotma il.com> wrote in message
                    news:1142461896 .803383.3310@z3 4g2000cwc.googl egroups.com...[color=blue]
                    > Crystal Clear, Thanks alot dean Im just gona start playing about with
                    > it for a moment and hope to get it working,[/color]


                    I am 100% sure this works.
                    However, I know that Access forms can become confused when you are working
                    with them - and in the worst case they can become irreversibly corrupted.
                    However, it might not be that bad.
                    Make sure that your field and textbox names are different:
                    For example, the field in the table is CreatedBy the textbox name is
                    txtCreatedBy and the default value is =CurrentUser()

                    If this is still not working, just take 30 seconds to create the most basic
                    of forms bound to the table, just to verify that what we are telling you
                    should (and normally does) work.


                    Comment

                    • Kay

                      #11
                      Re: current user

                      Thats a very good tip, I created another table and a form and put a
                      bound field in the form and the same currentuser() code in the default
                      value of the field works. It must be something wrong with my db

                      Comment

                      • Kay

                        #12
                        Re: current user

                        THANKYOU all for your help, I have got it to work. I feel very thick at
                        this moment because I just clicked the add button and realised that the
                        user field changed to the current user Doh! Thats all it took

                        Comment

                        • Anthony England

                          #13
                          Re: current user


                          "Kay" <khal_786@hotma il.com> wrote in message
                          news:1142466432 .968079.96050@j 52g2000cwj.goog legroups.com...[color=blue]
                          > THANKYOU all for your help, I have got it to work. I feel very thick at
                          > this moment because I just clicked the add button and realised that the
                          > user field changed to the current user Doh! Thats all it took[/color]


                          Doh!


                          Comment

                          Working...