, , . . , :
Dim mcolDateFields As New Collection
OnLoad :
mcolDateFields.Add Me!txtDateEntered, "txtDateEntered"
mcolDateFields.Add Me!txtDatePrinted, "txtDatePrinted"
mcolDateFields.Add Me!txtDateArchived, "txtDateArchived"
, - :
Dim varItem As Variant
Dim ctl As Control
For Each varItem In mcolDateFields
Set ctl = varItem
Debug.Print ctl.Name & ": " & ctl.Value
Next varItem
Set ctl = Nothing
... Debug.Print , .
, - :
Public Sub (mcolCollection As Collection)
Dim varItem As Variant
Dim ctl As Control
For Each varItem In mcolCollection
Set ctl = varItem
Debug.Print ctl.Name & ": " & ctl.Value
Next varItem
Set ctl = Nothing
End Sub
, . , , . , :
Dim varItem As Variant
Dim ctl As Control
For Each varItem In mcolCollection
Set ctl = varItem
Debug.Print ctl.Parent.Name & "!" & ctl.Name & ": " & ctl.Value
Next varItem
Set ctl = Nothing
, , Me , ctl.Parent, , ( , , ).
- :
Private Sub ExampleProc1()
Dim intCancel as Integer
intCancel = False
Me.Controls("Date1").Value=Null
Me.Controls("Textfield1").Value=Null
Call Date1_BeforeUpdate(intCancel)
Call Textfield1_BeforeUpdate(intCancel)
End Sub
, , - , True (-1). , ββAccess VBA VBA, Access Basic Boolean. , Booleans , Cancel.
Me.Controls("Date1").Value=Null
, . :
Me!Date1 = Null
, : . , Controls Fields, , , , , . , , , , , , , .
,.Value , . , , , , - , ByRef, ByVal. , , .
, , . , .