The On Dirty feature/property

Croco

Registered User.
Local time
, 04:08
Joined
Sep 16, 2009
Messages
18
Hi, is there a ready explanation of the various property selections available.
I have tried to understand the Microsoft Help within Access 2003 and I have so much difficulty grasping the lamguage/terminology.

In particular the On Dirty property was proffered as a solution to a problem I had earlier. Although I replied with a request to explain a lttle more as yet I have not been able to get a response. I also note the frequent use of "Me. " preceding some event expressions. What does this mean?

Any form of help or redirection to a resource of information would be greatefully appreciated.

Thanks to all so far and in the future....


Croco
 
Thanks...the "Me " thing is a little clearer now. I understand that there is a subtle difference for the use of "!" and "." depending whether using Access derived VBA statements (the former) as opposed to those in setting parameters in form/report properties (the latter). Is that correct? The accompanying website looks like the answers to many more matters will be explained.
Croco.
 
I understand that there is a subtle difference for the use of "!" and "." depending whether using Access derived VBA statements (the former) as opposed to those in setting parameters in form/report properties (the latter).

There is a lot of mythology about the difference and that one is the most common. It isn't to do with Access or VBA being the source. Many developers use them somewhat randomly.

The bang operator (!) is meant to be used between collections and objects while the dot operator (.) is used before properties and methods.

So:
Forms!formname!controlname.Visible
though because of ommitted defaults this expression is actually:
Forms!formname.Form!Controls!controlname.visible
Form and Visible are properties so never: formname!Form!controlname

However since an object should not be given a name that is a property or method, Access and VBA understand expressions by the names and work with the dots everywhere. Indeed the autocomplete in VBA only works with dots.
 
  • Like
Reactions: dcb
Thanks again...phew! How long does one actually have to dabble in this sort of thing before even just a small percentage of such wisdom begins to stick. Then again...I guess that's just it - "stick at it". Once again, thanks for the website - there is an awful lot there to get the head around and will be very useful as I begin to grow in this world.
Croco
 
Fortunately a little sticks each day even though you might wonder how you could remember so much. It looks really confusing at first but after a while the patterns begin to emerge and you turn a corner. At this point you begin realise the enormous potential of Access. Then you go through this cycle again at least a couple of times.

Developers with a decade of experience say they are still learning. It is one of the great things about Access. You will never run out of new challenges.

Just keep trying. You will learn as much from what doesn't work as what does.
Google is the developer's friend.
 
Thankyou for your blessings and encouragement. There must be a marvelous mind meandering mischievously out there to keep a lot of people occupied. Do you think that this was the underlying scheme of things that Uncle Bill secretly started out to do all those years ago?

I do thankyou and appreciate the time you have taken with me in this thread...

Croco
 
Just to add on that the true extent and reasoning behind dot vs bang hasn't been explained here yet, and it can take considerable length to do so, hence a link to a time when such a post was made is in order. ;-)

Cheers
 
Leigh, Thank you too. I am indeed very, very much appreciatie of all this assistance being directed my way. A quick glance at the link certainly invites some intense reading. :-)

Croco
 
I think when the property gets downs from its real value that time is so much bad for buyer specially because that time he is totally on loss!:mad:
 
the dirty property gives a method in code to establish whether a record has been edited, and therefore needs saving

if you have record selectors visible, the black triangle changes to a pencil to show the record has been edited, and needs saving. you can save the record by

a) clicking the pencil
b) setting dirty = true
c) using a menu item something like records/save
d) moving to a new record
e) closing the form
f) running the appropriate argument of docmd or runcommand (I think they both have save methods)

what you have to be careful about is what happens if the save fails - which it can do if any of your table constraints are broken eg duplicate items/blank data etc etc - in which case you need to handle the problem gracefully. so there are occasions when

if me.dirty then me.dirty = false doesnt cut the mustard on its own!
 
Last edited:
if me.dirty then me.dirty = false doesnt cut the mustard on its own!
However, that code does invoke the Before Update event which CAN have all sorts of validation on it and then cancel the update (even the setting of dirty to false) if the validations do not pass.
 
I found this thread very interesting. I have a mulituser database (access 2003) that the users periodically receive lock out popups. The whole database freezes and the users need to exit out and re-enter to clear the warning.
I am trying to figure out the best was to implement the dirty function and whether or not something like this would actually work.
For instance if I have a yes no click button on a form along with a filter button and some one is clicking the yes/no button while another user is filtering a list of accounts, would you use a if me.dirty then me.dirty = false so that the two do not interupte eachother?

I too am trying to understand the full functionality of the Dirty function.
 
I have a mulituser database (access 2003)
So, does that mean that it is split into a frontend/backend and each user has a copy of the frontend on their machine? If not, it needs to be that way and if so it should solve your problem.
 
Yes, it is split with a front end and a back end. A copy of the front end is on everyones desktop.
 
Do you have your locks set to this:

attachment.php
 

Attachments

  • reclocks01.png
    reclocks01.png
    59.1 KB · Views: 368
Last edited:
Hello,

The settings are exactly like yours...have you seen this before?
 
Still researching this. I think we are going to try

IF me.dirty Then Docmd.RunCommand accmdsaverecord

instead of
IF me.dirty then dirty = False


Any suggestions WetBlanket? Have you come accross this issue?
 
Still researching this. I think we are going to try



instead of



Any suggestions WetBlanket? Have you come accross this issue?

The dirty function will not work because it doesn't go beyond the current user's form. Even if two people have the same form open it is not the same form. It may have the same records, but not the same form. It shouldn't matter if more than one person is looking at a record or not. The only time it matters is if they try to save at the same time or close enough where there is a lock for one and the last to update will win.

Freezing up is more likely a symptom of a slow network OR perhaps a bad Network Interface Card (NIC) somewhere on one machine (including on the server).
 

Users who are viewing this thread

Back
Top Bottom