Results 1 to 7 of 7
  1. #1
    sizemoreg is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jun 2015
    Posts
    6

    Exclamation GetUserName help please

    Good Day


    I am in need of some help. My dilemma is with getting User name data when my team enters and/ or edits records. What I have is an invoice processing database. This database records Invoices received, audited, and paid. With this database I have 3 separate steps that require a different user to process an Invoice. This requirement comes from a SOX compliance standard, the same user can't enter the Invoice into the system, then audit the invoice for payment approval, and finally pay the invoice. 3 different people have to be involved to insure that data is valid before being paid out.

    I need to record each person's contribution to this process. I've tried code I found (fOSUsername() ), which accurately records the initial entry, but then as it progresses through the other steps, a new record is created ( making duplicate and triplicate Invoice entries)<- not good. I need to record all this within the one record. I am sure I missed, or haven't found the correct coding to make this happen, and this is where I need help. The ability to only record multiple users in one record.

    Currently my table is set up in this fashion

    Header row: [ID] [EntryAgent] [AuditAgent] [PaymentAgent] [InvoiceRecieptDate] [InvoiceEntryDate] [ApprovedAmount] [PaymentAmount]
    001 John Doe Jane Doe Jr. Doe 01/01/2015 01/02/2015 $5.00 $5.00


    I would appreciate any direction, or help I can get

    Thanks

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    vUser = Environ("Username")

    you dont put multi users in 1 record. you make several records.

  3. #3
    sizemoreg is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jun 2015
    Posts
    6
    Yeah, that's where I hit the wall. I can't have multiple records of one Invoice number. I currently have my table set up with 3 fields, one field for each person, they just search for that record and edit their part of the process. I was hoping to get something that would automatically add their login name (username) without creating a whole new record.

    Thanks for the quick reply

  4. #4
    nick404's Avatar
    nick404 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    May 2015
    Location
    Wisconsin
    Posts
    352
    Could have a login form to open on db load and then your form will pull the username info from that form. Can be unbound

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Subsequent users must find the existing record for editing. It seems you are trying to implement a search process but without reviewing attempted code and/or better understanding of data structure and form design, we really can't advise. If you want to provide db for analysis, follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Assuming, from your narrative, that

    • The EntryAgent originates the Record
    • The AuditAgent approves the amount to be paid
    • The PaymentAgent actually makes the payment


    you can have the appropriate 'agent' Field populated when the Control each agent is responsible for is completed...something like this:

    Code:
    Private Sub InvoiceEntryDate_AfterUpdate()
     Me.EntryAgent = Environ("Username")
    End Sub
    
    Private Sub ApprovedAmount_AfterUpdate()
     Me.AuditAgent = Environ("Username")
    End Sub
    
    Private Sub PaymentAmount_AfterUpdate()
     Me.PaymentAgent = Environ("Username")
    End Sub

    This presupposes that your users aren't intentionally trying to jigger your system! Making sure that all three agent names are different could be done, but would require additional code for a validation check to be made before each agent name is entered.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  7. #7
    knarfreppep is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Feb 2015
    Location
    Adelaide, Australia
    Posts
    106
    This is an approach one might consider.

    When the operator opens the app (logs on) use the AfterUpdate event of a combo box behind which is their ID, Name, and Password to set a global variable e.g. gintCurrentOperatorID.

    For each table which is sensitive/ciritcal, have an 'audit trail' table, e.g. tblInvoices > tblInvoices_AuditTrail.

    In the AfterUpdate event of the form(s) sitting on e.g. tblInvoices
    populate fields dtmCreated, intCreatedBy, dtmLastChanged, and intLastChangedBy as appropriate using Now() and gintCurrentOperatorID then run a query to append the full new/changed record to tblInvoices_AuditTrail .

    You'll allways be able to determine exactly who did what and when and roll back if necessary.

    And records in tblInvoices_AuditTrail could tell the 'story' of an invoice's progress using a 'status' flag: new, approved, part-paid, paid, reversed, etc.

    I like to also put an 'Audit' button on the form(s) to show dtmCreated, intCreatedBy, dtmLastChanged, and intLastChangedBy ... this is 1) handy and 2) a useful internal control because it lets operators know their activity is being tracked (i.e. if your objective is to prevent fraud rather than just catch it after the event).

    As to the 'separation of duties' problem, it's simple to prevent operators from seeing records and having rights over adding and changing records according to their role(s).

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

Similar Threads

  1. GetUserName
    By Larryg in forum Code Repository
    Replies: 5
    Last Post: 05-23-2015, 10:26 AM
  2. Getusername of currently logged in user
    By nkuebelbeck in forum Access
    Replies: 8
    Last Post: 06-29-2011, 04:06 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