vendredi 29 juillet 2016

If Statement to change field.control source

I have a small If statement that that changes the controlsource of a field if another field is empty. The " just before = is incorrect, and I'm not sure what to use to ensure the entire string starting with the = is included.

Private Sub Report_Load()
If IsNull(FirstName2) Then
OwnersNames.ControlSource = "=FirstName1] & " " & [LastName1]"
Else
OwnersNames.ControlSource = "=[FirstName1] & " " & [LastName1] & " and " & [FirstName2] & " " & [LastName2]"
End If
End Sub

Aucun commentaire:

Enregistrer un commentaire