ACC: Do Not Jump into WITH Statement Blocks (137121)
The information in this article applies to:
- Microsoft Access for Windows 95 7.0
- Microsoft Access 97
This article was previously published under Q137121 SUMMARY
Advanced: Requires expert coding, interoperability, and multiuser skills.
The With statement enables you to perform a series of references to a
specified object without having to repeat the name of the object. For
example, if you have a number of different properties to change on a single
object, it is more convenient to place the property assignment statements
inside the With control structure. In this manner, you have to refer to the
object only once instead of having to refer to it with each property
assignment.
The following example illustrates the use of the With statement to assign
values to several properties of the same object:
With MyLabel
.Height = 2000
.Width = 2000
.Caption = "This is MyLabel"
End With
The With statement behaves differently from other block structures in
the Basic programming language. The With statement does not allow you to
use a GoTo statement to enter the With/End With statement block. Other
block structures like "If/End If" and "Select Case/End Select" in the Basic
programming language support the GoTo statement.
This article assumes that you are familiar with Visual Basic for
Applications and with creating Microsoft Access applications using the
programming tools provided with Microsoft Access. For more information
about Visual Basic for Applications, please refer to your version of the
"Building Applications with Microsoft Access" manual.
REFERENCES
For more information about the With/End With statements, search the Help
Index for "With Statement," or ask the Microsoft Access 97 Office
Assistant.
Modification Type: | Minor | Last Reviewed: | 10/11/2006 |
---|
Keywords: | kbinfo kbProgramming KB137121 |
---|
|