Forms

A

Abdul Shakeel

Can anyone defien me the differnce between

[Forms].[frm1]
and
[Forms]![frm1]

when we use a "." and when "!"
 
J

James A. Fortune

Abdul said:
Can anyone defien me the differnce between

[Forms].[frm1]
and
[Forms]![frm1]

when we use a "." and when "!"

From A97 help:

Use the ! and . (dot) operators in expressions

"You use the ! and .(dot) operators in an identifier to indicate the
type of item that immediately follows.
The ! operator indicates that what follows is a user-defined item (an
element of a collection). For example, use the ! operator to refer to an
open form, an open report, or a control on an open form or report.

Identifier Refers to
Forms![Orders] The open Orders form
Reports![Invoice] The open Invoice report
Forms![Orders]![OrderID] The OrderID control on the open Orders form
The . (dot) operator usually indicates that what follows is an item
defined by Microsoft Access. For example, use the . (dot) operator to
refer to a property of a form, report, or control.

Note You can also use the . (dot) operator to refer to a field value
in an SQL statement, a Visual Basic for Applications method, or a
collection. For example, the identifier Forms![Orders].Controls refers
to the Controls collection of the Orders form. However, because the
Controls collection is the default collection for forms and reports,
it's usually not necessary to refer to it explicitly."

Access developers have discovered that the rules for when to use a dot
and when to use a '!' aren't as hard and fast as the help file would
lead you to believe. This has led some developers to base their choice
on the relative strengths of the two approaches. Personally, I usually
stick to the help file recommendations because they help me see what I'm
doing at a glance coupled with the fact that I haven't run into
situations where the default choice is noticeably detrimental. You can
do a Google search on this newsgroup or on comp.databases.ms-access to
discover which situations are better suited to each method.

James A. Fortune
[email protected]
 
Top