Reputation: 1
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
Upvotes: 0
Views: 138
Reputation: 1444
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
Upvotes: 1
Reputation: 2108
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
Upvotes: 0