Hello,
I need to populate my field "FullName" with Title + FirstName + MiddleInitial + LastName. The tricky part is that I am not making the Title or MiddleInitial a mandatory field. So, I need to run it through a few IF statements before populating the field. This is what I did so far and I got a "Run-time error 424 Object required". I thought the code was pretty straight forward, but it's not working. I made the event when the user enters the field following the LastName, which is the Address1 field.
I need to populate my field "FullName" with Title + FirstName + MiddleInitial + LastName. The tricky part is that I am not making the Title or MiddleInitial a mandatory field. So, I need to run it through a few IF statements before populating the field. This is what I did so far and I got a "Run-time error 424 Object required". I thought the code was pretty straight forward, but it's not working. I made the event when the user enters the field following the LastName, which is the Address1 field.
Private Sub Address1_GotFocus()
If Me.Title.Value Is Null Then
If Me.MiddleInitial.Value Is Null Then
Me.FullName.Value = Me.FirstName.Value + " " + Me.LastName.Value
Else
Me.FullName.Value = Me.FirstName.Value + " " + Me.MiddleInitial.Value + " " + Me.LastName.Value
End If
Else
If Me.MiddleInitial.Value Is Null Then
Me.FullName.Value = Me.Title.Value + " " + Me.FirstName.Value + " " + Me.LastName.Value
Else
Me.FullName.Value = Me.Title.Value + " " + Me.FirstName.Value + " " + Me.MiddleInitial.Value + " " + Me.LastName.Value
End If
End If
End Sub
If Me.Title.Value Is Null Then
If Me.MiddleInitial.Value Is Null Then
Me.FullName.Value = Me.FirstName.Value + " " + Me.LastName.Value
Else
Me.FullName.Value = Me.FirstName.Value + " " + Me.MiddleInitial.Value + " " + Me.LastName.Value
End If
Else
If Me.MiddleInitial.Value Is Null Then
Me.FullName.Value = Me.Title.Value + " " + Me.FirstName.Value + " " + Me.LastName.Value
Else
Me.FullName.Value = Me.Title.Value + " " + Me.FirstName.Value + " " + Me.MiddleInitial.Value + " " + Me.LastName.Value
End If
End If
End Sub