Form vs. recordset

R

Randy4BillsN3

I need a refresher. When I first started database development with
Access, I knew the
answer to this question, but it slips my mind now. What is the
difference in VBA between the floowing references in code:

Me!Anydata
Anydat
Me.AnyData
[AnyData]


If I remember correctly, it has to do with the value shown on a control

versus the recordset behind a form, but cannot remember which is which.
Many times the difference is not inportant as my code seems to work
with either. If not, I get to it by trial-and-error. But I hoping
someone could remind me what the difference is.
 
S

Stefan Hoffmann

hi,

What is the
difference in VBA between the floowing references in code:
Me!Anydata
Anydat
Me.AnyData
[AnyData]
If I remember correctly, it has to do with the value shown on a control
versus the recordset behind a form, but cannot remember which is which.
Google for bang vs. dot.


mfG
--> stefan <--
 
M

Marshall Barton

I need a refresher. When I first started database development with
Access, I knew the
answer to this question, but it slips my mind now. What is the
difference in VBA between the floowing references in code:

Me!Anydata
Anydat
Me.AnyData
[AnyData]


If I remember correctly, it has to do with the value shown on a control

versus the recordset behind a form, but cannot remember which is which.
Many times the difference is not inportant as my code seems to work
with either. If not, I get to it by trial-and-error. But I hoping
someone could remind me what the difference is.


There is no significant difference.

The square brackets are only significant when the name
contains a non-alphanumeric character. Best practice is to
only use alphanumeric characters.

Using Me disambiguates the name as a field or control in the
form. Without Me, the name could be confused with a VBA
variable of the same name. Best practice is to use Me

Follow Stfan's suggestion for the nuances between Bang and
Dot when referring to a field/control.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top