Solved

Dirty skipping line in code

Posted on 2011-02-17
2
276 Views
Last Modified: 2012-05-11
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
Comment
Question by:4charity
2 Comments
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Access MVP) earned 250 total points
ID: 34918745
Maybe you need to include

If Me.NewRecord = True ' or False

somewhere.

Where is that code above located - what event ?

mx
0
 
LVL 11

Assisted Solution

by:thydzik
thydzik earned 250 total points
ID: 34970501
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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question