Suppose you have an open form "MyForm"
From within the form, you can refer to the Form object in one of the following ways:
Forms![MyForm] (general Access notation)
Forms("MyForm" (general VB notation) Me
The same goes for reports:
Reports![MyReport]
Reports("MyReport" Me
In conclusion, Me refers to the form or report where the code resides. Using Me in a module will generate a compile error.
Many times it can be ignored, so:
Me.RecordsetClone
can be successfully replaced by
RecordsetClone
It's a matter of personal preference if you use it or not. I use it when I am too lazy to type a full property name. Using Me enables the wonderful VB dot thing which speeds up code development.
And a tiny notice:
RecordsetClone is just one word, not two separated by a dot.
HTH
Daniel Vlas
Systems Consultant
danvlas@yahoo.com
The reason "Me" exists is to make code potentially more 'transportable'.
As Dan and Ken have mentioned Me refers to the form or report where the code resides. so any standard bits of code that you have that need to refer to the current form object can be dropped into the Form's code and you do not need to refer to the form explicitly by name.
( same for Reports )
Eg.
Requery the current form Me.Requery
Open a Report using the Current Form's existing Filter property as the selection criteria for the Report
DoCmd.OpenReport "rptReportName", acPreview, , Me.Filter
etc.
'ope-that-'elps.
G LS
accessaceNOJUNK@valleyalley.co.uk
Remove the NOJUNK to use.
Please remember to give helpful posts the stars they deserve!
This makes the post more visible to others in need! :-D
In addition to all this, me. is evidently a bit faster than forms!ThisForm. I'm sure that on any computer I'd be willing to use, that efficiency is trivial, but there you have it.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.