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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Variable Help 1

Status
Not open for further replies.

WildGun

Technical User
Jan 13, 2005
15
US
Hi

What is the point of a period in front of a variable?

ex: ".DTREnable"

Thanks

Randy
 
Dot notation indicates a property or method of an object. If you find the first part of a variable is a period, it is because it's included in a with statement:

Code:
'This code assumes that cn is a valid and open ADO connection object, and that myCmd is a valid ADO command object.
'Using the with statement
With myCmd
     .ActiveConnection = cn
     .CommandText = "delete from customers"
     .Execute
End With

'Not using the with statement
myCmd.ActiveConnection = cn
myCmd.CommandText = "delete from customers"
myCmd.Execute

The with statement is more efficient, since the runtime only has to figure out which object is being used once instead of once for each property being set or method being called.

I'm unaware of any other manner in which a "variable" may be preceded by a period. In your example, DTREnable is a property associated with the MSComm control. So, you should see a with block that encloses .DTREnable, and it should say with SomeName, where SomeName is the name of an MSComm control that you can find on the form that contains the code.

HTH

Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top