Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"." vs "!" in forms, subforms, controls, etc 1

Status
Not open for further replies.

BigTeeJay

Technical User
Jun 13, 2001
106
0
0
US
Greetings,
Along the lines of FAQ181-447 (which I am not able to understand, the poor guys post appears to have been mangled in the process)... I am trying to figure out when it is appropriate to use "." vs "!".

For example if referencing a control on the current form, you could do Me.ControlName, or it seems you can do Me!ControlName, or sometimes you use Forms.formname, and other times Forms!Form_Formname, or is it Forms!Formname!?!?!

Does anyone know of a document (or could share a rules of thumb) that would help clarify this?

Regards,
Tj

PS: I accidently posted this to the "MS Access: Other" board first, I had two windows open, an didnt realize I was posting it there until it was too late..,
 
Hello Tj,
The "." operator is used when you are accessing a property, or method of an object. The "!" is used to access objects in a collection i.e. the Forms, Tables, QueryDefs, or even a Recordset's fields collection. You will find that Access will often be forgiving in the missuse of these operators, but try using the "." operator with a Recordset to access a field (objRSet.fldLastName instead of objRSet!fldLastName) and you will see that you won't get too far.
Good Luck, Robert
•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•
Professional, affordable, Access database solutions and assistance °•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°
 
Hello all,
There seems to be a lot of misunderstanding as to the use of the bang (!) operator :-(.

Please look at the following:
Or to be exact:
This should clear up any confusion. If not check out:
Robert
•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•
Professional, affordable, Access database solutions and assistance °•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°
 
I always thought the short hand rule of thumb was if you created the object, use !, Otherwise use "." Always worked for me.
 
Yes and no, the objects that you are creating are being added to a collection... whether it is a form that is going into the Forms collections or a text box that is going into a form's controls collection. It's still a collection of objects. Robert
•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•
Professional, affordable, Access database solutions and assistance °•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°
 
Thank you all, that was more detailed/helpful that I imagined :) My sincerest aplogies for the cross post (I wish you could delete/move your posts... oh well).

After readin SoloDroid's post, his seems to have the most technical info (something to keep in mind, or keep bookmarked for reference).

But I agree that WildHare's post should work well as a good rule of thumb (if it somehow fails you, you have SoloDroid's reference info).

If no one else wants to, I will create a FAQ for this using you guys posts (and names of course)... I wouldnt know how else to give you credit (other than putting your nick/handle in).

Regards,
Tj
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top