Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question About Dirty Status

Status
Not open for further replies.

cpsqlrwn

IS-IT--Management
Jul 13, 2006
106
0
0
US
The code below is being used to change focus. It was suggested by a person on the forum and I was wondering if someone could explain the use of the Dirty method and what its significance is in this code? Why would it be needed? Thank you.



Code:
Dim AddItems As Object
    Set AddItems = Forms!ProductionForm!ProductionSubForm1!ProductionBatchAddItemsTabSubForm

    Me.Dirty = False
    AddItems.SetFocus
    AddItems!ItemUsed.SetFocus
 
First visit here for a while, and I'm a little rusty but as far as I can remember, Dirty identifies whether the contents of the current record has been modified in any way.

So in your example, 'If Me.Dirty=False' equates to 'if the current record has not changed since it was loaded'

Then the code goes on to say that if the above criteria has been met, move the cursor to the ItemUsed field on the subform called 'ProductionBatchAddItemsTabSubForm'.

I would imagine that the code is designed to ensure this field has been updated before allowing the user to move on to another record.

Cheers,

Chris
 
Me.Dirty = False
does the same thing than:
DoCmd.RunCommand acCmdSaveRecord

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top