Concatenation operator &

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

how do i add a dash between each string and if there is no string2 not have
the dash appear
 
Assuming that string2 is Null, and not just an empty string (""), you can
take advantage of the fact that + works differently with concatenation than
&:

string1 & ("-" + string2)

If it's not null (or if it's sometimes Null but sometimes not), you'll need
something like

string1 & IIf(Len(string2 & "") > 0, "-" & string2, "")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top