0

I am trying to make a conditional statement that will basically say if field1 + field2 = "string" then do some stuff... i am pretty sure i have the stuff part right but i dont think i have the conditional statement correct... this is what i have

txtTeam.Visible = True
If ([GuestFirstName] + [GuestLastName] = "Angela Cockrill") Then
    [LifetimeTxt] = "Trips of a Lifetime!"
    txtTeam.ForeColor = vbOrange
    txtTeam.FontSize = 14
    txtTeam.FontBold = True

Else
    txtTeam.Visible = False
    txtTeam.ForeColor = 0

End If

2 Answers 2

1

In MS Access VBA I would use the ampersand operator & to concatenate 2 strings together, not the plus sign but that's just a preference. You also may need to account for the space e.g.

txtTeam.Visible = True
If ([GuestFirstName] & " " & [GuestLastName] = "Angela Cockrill") Then
    [LifetimeTxt] = "Trips of a Lifetime!"
    txtTeam.ForeColor = vbOrange
    txtTeam.FontSize = 14
    txtTeam.FontBold = True

Else
    txtTeam.Visible = False
    txtTeam.ForeColor = 0

End If
Sign up to request clarification or add additional context in comments.

Comments

0

Depending on what you have in your fields you probably need to add the space, as well as use ampersands:

If ([GuestFirstName] & " " & [GuestLastName] = "Angela Cockrill") Then

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.