Solved

Dirty skipping line in code

Posted on 2011-02-17
2
265 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

911 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now