Results 1 to 5 of 5
  1. #1
    jehanim009 is offline Novice
    Windows 8 Access 2013
    Join Date
    Dec 2015
    Posts
    1

    Record username of last modified when query is edited

    Hi,

    I've used the fOSUsername() macro to record usernames easily in forms previously.



    However, I now need the following:

    a) Generate a query via a filtering form.

    b) The query should have a checkbox field which has to be ticked if a record is valid.

    c) The username of the person ticking each record should be recorded in a separate field.

    I've completed parts a and b.

    However, I'm not sure if adding a macro into a query in order to complete part c is possible.

    Please help!

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    You can call a VBA function sub-procedure, like fOSUsername, from a query and use the value that the function returns. However, you have an additional requirement of using an Event. Events are triggered by Users. For instance, changing the value of a control.

    I suggest you use VBA code behind a bound control's AfterUpdate event to update the UserName field in you table.

  3. #3
    InsuranceGuy is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Aug 2015
    Location
    Colorado
    Posts
    126
    If your intent is to take action based on changes on the query, attach the query to a form, then you can capture on_change to call your function and set your modified_by field to the user ID. I don't believe you can do this outside of a form for update events.

    Cheers,

    Jeff

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by InsuranceGuy View Post
    ...you can capture on_change to call your...
    I would not recommend the OnChange event in this circumstance because this event for a control will fire every time the Text property changes. For instance, every character that is typed into a text box control will fire the event, once for every character typed.

  5. #5
    HiTechCoach's Avatar
    HiTechCoach is offline MS MVP - Access Expert
    Windows 8 Access 2013
    Join Date
    Jul 2010
    Location
    Oklahoma, USA
    Posts
    705

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

Similar Threads

  1. Replies: 11
    Last Post: 06-28-2014, 10:50 AM
  2. Count - Sum Total a record is modified
    By mike760534211 in forum Access
    Replies: 6
    Last Post: 01-08-2014, 03:30 PM
  3. Last Modified Record
    By drunkenneo in forum Programming
    Replies: 1
    Last Post: 01-06-2014, 10:58 PM
  4. creating an edited record report
    By mike02 in forum Access
    Replies: 4
    Last Post: 06-13-2013, 08:36 AM
  5. Replies: 9
    Last Post: 05-12-2012, 12:16 PM

Tags for this Thread

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