Results 1 to 10 of 10
  1. #1
    sai_rlaf is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jan 2011
    Posts
    44

    How to Log the user and date a record was completed

    I have a form that is being used by about 4 people as a queue system. There is status field that indicates when something is new, pending, and completed. I would like to create a macro that is linked to a button that does the following.



    - If a record is marked with a completed status, then that record add's today's date in the completed date field and add's the user's information to the Reviewed by field.

    Any ideas on how to make that happen? I used 2007 but can use 2003 if I need to use .mdb security settings. I was wondering if its possible to use the "User name" field in the Access Options?

  2. #2
    JeroenMioch's Avatar
    JeroenMioch is offline Competent Performer
    Windows Vista Access 2003
    Join Date
    May 2012
    Location
    Den Haag, Netherlands
    Posts
    368
    If me.[Status].value = "Complete" then
    me![DateField] = date()
    me![UserInfo] =fOSUserName()

    Something like that ?

  3. #3
    sai_rlaf is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jan 2011
    Posts
    44
    Those criteria work, I'm having trouble getting to only update the record I'm updating. It wants to go and update every record in the database with a completed status. I can I get to only do the record I'm updating?

  4. #4
    JeroenMioch's Avatar
    JeroenMioch is offline Competent Performer
    Windows Vista Access 2003
    Join Date
    May 2012
    Location
    Den Haag, Netherlands
    Posts
    368
    Thats rather strange..
    Normally, only the current record is affected uless i tell it to do otherwise.

    Try this :

    With Me.RecordsetClone
    .MoveLast

    'your codes here

    end with

    That tells it to go to the last record in your recordset, this is normally the current (on screen) record.

  5. #5
    sai_rlaf is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jan 2011
    Posts
    44
    Maybe we are in different places. Where are you inputting your data? I'm using an Update query. Are you writing some VBA code or something?

  6. #6
    JeroenMioch's Avatar
    JeroenMioch is offline Competent Performer
    Windows Vista Access 2003
    Join Date
    May 2012
    Location
    Den Haag, Netherlands
    Posts
    368
    Oh yes were definately NOT in the same place haha.
    My codes is VBA coding.

    You told me that you had a form, so i was guessing there was a record on it that needed updating on your form.

  7. #7
    sai_rlaf is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jan 2011
    Posts
    44
    It keeps taking me to fOSUserName() and saying it's not defined. Any thoughts? Do I need to have security set up?

    Thanks for your help so far.

  8. #8
    JeroenMioch's Avatar
    JeroenMioch is offline Competent Performer
    Windows Vista Access 2003
    Join Date
    May 2012
    Location
    Den Haag, Netherlands
    Posts
    368
    Nope,

    Im trying to let u use the windows or network login name.
    I might have set u on the wrong track because i forgot it there was a module to go with it.

    Follow the instructions in the link below if you think its of use for your project.

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

    If you made the module you call it with = FOSUsername()

    its a good way to keep track of what user is doing things.

  9. #9
    nhior is offline Novice
    Windows XP Access 2000
    Join Date
    Jul 2011
    Posts
    3
    you can log the user what they do in the system by stamping..should be your table have a field name: who make update, when update.call the user name from the login by modules..then make something in the form in before update or after update..like this [username]= user; [lastupdate]=now() or use date()

  10. #10
    sai_rlaf is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jan 2011
    Posts
    44
    Awesome Jereon. Thanks for the help. One more question and I'll leave you alone I promise. Below is the code I have so far. What I would like to do is add another condition before the update is made. I want to require that a particular follow up date field must be entered before the update occurs. If it's not entered, then the update won't go farther and instead they will get a msg box saying "Please enter a follow up date".

    If Me.[Follow Up Status].Value = "Pending - Confirmation Needed From Sponsor Company" Then
    Me![Reviewer] = fOSUserName()
    MsgBox "Record Follow Up Status Successfully Updated"

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

Similar Threads

  1. Replies: 12
    Last Post: 04-20-2012, 06:34 AM
  2. Adding employee hours done for each completed sale
    By crxftw in forum Database Design
    Replies: 2
    Last Post: 06-16-2011, 12:24 PM
  3. Completed Database - Packaging?
    By AccessFreak in forum Database Design
    Replies: 1
    Last Post: 01-10-2011, 12:06 PM
  4. Replies: 1
    Last Post: 07-07-2010, 04:22 PM
  5. Replies: 0
    Last Post: 09-01-2009, 12:33 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