Re: Common Procedure

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



A common procedure is great idea. However, for ONE LINE of code, I don't
really think it is great benefit.

Further, I would avoid using "domenuItem", as that suggests a particular
version of ms-access, and further a particular menu bar. So, another great
developer suggestion is to AVOID these menu type commands.

To force a disk write, you can use:

me.Refresh

However, the above while only one line of code is better changed with:


if me.Dirty = True then
me.dirty = false
end if

So, the above is 3 lines of code....

Of course, the above uses the built in form reference called "me", and you
can't put that in a standard module. however, you an pass the form name.

Hence, you save code can be:

Call MySave(me)



You standard code module can thus be:


Public Sub MySave(frm as form)

if frm.Dirty = True then
frm.Dirty = false
end if

end sub

Note how by passing the form name, we can simply replace all of our "me"
prefix to "frm", and really just write our code as if it had been in the
"forms" code module. Using the above means we simply pass the form name, and
thus can make "common" code for all forms.

Anyway, try and stay away from those old style menu commands. they are tied
to particular versions, and you only lucky they work because MS works hard
to make those old confusing menu commands still work, but I would not bet my
applications on such syntax....


--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal@xxxxxxx


.



Relevant Pages

  • Re: How to log all commands?
    ... The users will be able to run several potentially dangerous tools (like ... The main point is that in the "front" of dangerous machines restriction ... I can avoid the use of other shells by having only bash, ... PROBABLY I'll implement the commands using sudo, ...
    (comp.os.linux.security)
  • Re: Odd VFP DO WHILE Behavior
    ... NULL is almost impossible to avoid. ... in commands expecting logical walue like WHILE DO or FOR ENDFOR is ... The loop code is not executed, which is what I would expect. ... The loop code is executed forever. ...
    (microsoft.public.fox.vfp.forms)
  • Re: Slightly OT: DVD players
    ... as slow to respond to commands as its predecessor and noisy in ... (so that I can avoid it!) ...
    (uk.tech.digital-tv)
  • Re: Slightly OT: DVD players
    ... as slow to respond to commands as its predecessor and noisy in ... (so that I can avoid it!) ...
    (uk.tech.digital-tv)
  • Re: How to create a Recommended Reading list?
    ... option that you wanted to avoid, and instead of typing all the \nocite ... unwanted lines and use "change" commands to convert the bibtex entries ...
    (comp.text.tex)