When to use ! or . (1 Viewer)

pekajo

Registered User.
Local time
Today, 14:29
Joined
Jul 25, 2011
Messages
133
Hi,
A simple question I have been meaning to ask. When using VBA what is the difference between using ! and . in say
DoCmd.GoToRecord , , acPrevious
vg = Me.IncGiven

I know the 'Me' but not the '.'
Thanks
Peter
 

Ranman256

Well-known member
Local time
Today, 00:29
Joined
Apr 9, 2015
Messages
4,337
i use ! for controls: forms!fMyform!txtBox
. to run routines: forms!fMyform.RunMyUpdate
 

Minty

AWF VIP
Local time
Today, 05:29
Joined
Jul 26, 2013
Messages
10,371
@Ranman256 - It's more complicated than that! Have you read the link?

Personally, I only ever use the ! where I have to, as errors are not picked up with intellisense.

I have inherited a legacy system where the original developer uses Forms! type references for everything instead of Me. even when on the form he was coding.
You can't rely on compiling it to find any typos or errors if you rename or move an object, it's an absolute nightmare.
He used the same syntax for parent objects of forms as well when Me.Parent. would have been much more appropriate.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 00:29
Joined
May 21, 2018
Messages
8,554
Do not read the whole thread go to the last post which summarizes and is more complete and more correct.
 

Users who are viewing this thread

Top Bottom