Results 1 to 8 of 8
  1. #1
    BSJoJaMAx4's Avatar
    BSJoJaMAx4 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2015
    Posts
    48

    Using access registration details


    Hi all again

    i have a database that many users add to. I need to record the name of the person who entered the record (for follow up purposes) which is done manually. Can I use the information recorded by access on first time use (name, initials etc) to auto stamp the record?

  2. #2
    NoellaG's Avatar
    NoellaG is offline VIP
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,044
    Hi,

    try using the environ("username") function

    kind regards
    NG

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    and set the DATE field to defaut value = NOW()

  4. #4
    BSJoJaMAx4's Avatar
    BSJoJaMAx4 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2015
    Posts
    48
    Hi NoellaG - I have set up a text box with default value =environ("username") but it returns #Name?. Anything I have missed?

  5. #5
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    you can't use environ as a default values - you need assign it in the form before update event e.g. something like

    me.user=environ("username")

    or if you just want to see it in an unbound textbox, then put =environ("username") in the textbox controlsource

    And to be pedantic, you should do the same for the timestamp

    me.timestamp=now()

    Why? because the default value is created when a new record is first created, but before it is saved. So if a new record is started at 1pm and before saving the user goes to lunch, has a meeting whatever before finally saving at 3pm, the timestamp will be 1pm, not 3pm. This may or may not matter for your purposes, but something to be aware of.

  6. #6
    BSJoJaMAx4's Avatar
    BSJoJaMAx4 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2015
    Posts
    48
    Thanks for that.

    I have created a new textbox unbounded on my main menu (just want to show a Welcome username message) and it shows #name? error message. Pasted
    Code:
    =Environ("username")
    int he data > control source box.

    On my record screen (where I want to record the record creater details) I have a new text box, in before update event I have
    Code:
    Private Sub Text149_BeforeUpdate(Cancel As Integer)Me.[CSQ Officer] = Environ("username")
    End Sub
    but its showing blank.

    i know its going to be something simple but at this stage its not obvious.

  7. #7
    NoellaG's Avatar
    NoellaG is offline VIP
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,044
    Hi again,

    I think the easiest solution for you is to create your own function in a general module:
    Code:
    Public Function GetUsername() As String
        GetUsername = Environ("username")
    End Function
    This function you can use to set the default value for your textbox:

    = getUsername()
    Just like you can use the buildin function.

    success
    NG

  8. #8
    BSJoJaMAx4's Avatar
    BSJoJaMAx4 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2015
    Posts
    48
    Thanks all that worked a treat.

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

Similar Threads

  1. Help! Access Registration Form
    By AccessNewb11 in forum Access
    Replies: 7
    Last Post: 04-30-2014, 01:50 PM
  2. Replies: 9
    Last Post: 12-18-2013, 02:49 PM
  3. registration database
    By hodagh in forum Queries
    Replies: 7
    Last Post: 11-05-2012, 12:52 PM
  4. Registration of Attendees
    By camende in forum Programming
    Replies: 1
    Last Post: 06-30-2010, 03:47 PM
  5. Registration Form
    By nengster in forum Forms
    Replies: 0
    Last Post: 02-16-2009, 04:22 AM

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