Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2004

    Unanswered: concatenation operators in addresses?

    Hello first post on this forum so go easy on me!

    I'm trying to format a simple address string in a report such that the address lines appear only when necessary and on the correct lines. Is there a valid operator for a return character in a string? I've got 5 fields: Address1, Address2, City, State, Zip. I want to leave off the Address2 field if it is blank (i.e. suite number/floor), and I want city, state, zip to appear on a line by itself immediately after address1, or address2 as the case might be. I want to get all of this in a single text box control, because I'm running low on space on my report. Here's what I'm playing with in my text box:

    =Iif([Address2] is Null, [Address1], [Address1] & "<returnchar>" [Address2]) & "<returnchar>" & [City] & ", " & [State] & " " [Zip]

    anyway I want the address to show up like this:

    111 Anywhere Street
    Suite 100
    New York, NY 10005


    112 Anywhere Street
    New York, NY 10005

    if Address2 is null.

    Anyone have ideas on how to accomplish this? I can't seem to find any resources for complete lists of string concatenation operators...just knowing how to put a return in a string would be a massive help.

    Thanks for any advice!


  2. #2
    Join Date
    Sep 2003
    Here is some code I wrote that does the same thing ...

                CustomerLbl.Caption = ContactName & vbCrLf & MyRecSet.Fields(3).Value & vbCrLf & MyRecSet.Fields(4).Value & vbCrLf
                If MyRecSet.Fields(5).Value & "" <> "" Then CustomerLbl.Caption = CustomerLbl.Caption & MyRecSet.Fields(5).Value & vbCrLf
                CustomerLbl.Caption = CustomerLbl.Caption & MyRecSet.Fields(6).Value & ", " & MyRecSet.Fields(7).Value & " " & MyRecSet.Fields(8).Value

  3. #3
    Join Date
    Jan 2004
    Where would I put such code? In a separate module or something? or in some event procedure for the report itself ? I'm not quite that advanced yet so I'm a little confused

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts