[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 306
  • Last Modified:

Dirty skipping line in code

I have a form on which I capture a User's ID and timestamp when a record is entered. However, sometimes another user will look at the record (before it is worked on), and that info gets recorded. I don't want that situation. So I put a Dirty criteria on the code. The thought is that the info will only be captured if it was the first time the record was actually worked on (not viewed):

If IsNull(Me.DateInvoiceInDTU) And Me.Dirty = False Then
        Me.DateInvoiceInDTU = Now()
        Me.UserLoggedInvoice = GetUserCredentials(2)
        Me.text2 = Me.ActiveControl.Name
End If

This code works, in that the Date is not recorded, and the text2 field is not recorded. However, the UserLoggedInvoice is recorded. Any suggestions?
0
4charity
Asked:
4charity
2 Solutions
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
Maybe you need to include

If Me.NewRecord = True ' or False

somewhere.

Where is that code above located - what event ?

mx
0
 
thydzikCommented:
have a line of code in all your field controls that set a flag only if a change is made.

update userloggedinvoice only if this flag is on.
0

Featured Post

Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now