Dave:
When the form loads the code puts "Enter Manager1" into the Manager1 control
(probably a text box) on the form if it is Null, i.e. does not already
contain a value. The Nz function returns the value of its second argument if
the first is Null, otherwise the value of the first.
Assuming this is in the Load event procedure of the form Switchboard Items,
instead of the fully qualify reference to the form, the Me keyword could be
used:
Me.Manager1 = Nz(Manager1, "Enter Manager1")
Note that the object names are not wrapped in square brackets here. This is
only necessary if the name includes spaces or other special characters as in
[Switchboard Items]. Note also that I've used the dot operator rather than
the exclamation mark. Nowadays the former tends to be favoured. The
exception is when a control on a form is referenced as a parameter in a
query, where the exclamation mark is still required.
Ken Sheridan
Stafford, England
Dave F said:
Can someone interpret this Access VBA code for me?
Private Sub Form_Load()
[Forms]![Switchboard Items]![Manager1] = Nz(Manager1, "Enter Manager1")
End Sub
I'm coming from the Excel world and so am not familiar with Access' VBA
syntax. What exactly does this Sub do?
Thanks,
Dave