Results 1 to 11 of 11
  1. #1
    4 Star Lounger
    Join Date
    Oct 2002
    Location
    Sayre, Pennsylvania, USA
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Combining Text fields (2000)

    Hi,
    I have a report that has a vendor address on it. I have the following field where I combine the City, State and Zip fields.
    =[City]&", "&[State]&" "&[Zip]
    The problem is when I have that field the city, state and zip does not show on the report unless I make the Can Grow/Shrink properties to yes, but when I do that it pushes all the data down a line and goofs up my lay out. All of the City, state and zip addresses can fit on one line. I'm not sure how to get around this.
    Thanks,
    Deb

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Combining Text fields (2000)

    Perhaps the text box should be slightly larger (higher and/or wider) while setting CanGrow to No.

  3. #3
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Combining Text fields (2000)

    If its an option, make the text in the report smaller to. It will help to fit the text in the textbox too. In the same light, it may help to widen the margins and shuffle the text box layout to fit !
    Regards,
    Rudi

  4. #4
    4 Star Lounger
    Join Date
    Oct 2002
    Location
    Sayre, Pennsylvania, USA
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combining Text fields (2000)

    That didn't seem to help. It's really weird because in the same area I combine contact first and last name and that prints. Is there a limit to the numbers of letters for combination. In the table for the 3 fields they have a length of 42. 30 for city, 2 for state and 10 for zip and they are all text fields.

  5. #5
    4 Star Lounger
    Join Date
    Oct 2002
    Location
    Sayre, Pennsylvania, USA
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combining Text fields (2000)

    I was able to get it to work by making the field taller. But I still think it's weird. I have another question. I've now tried to use the Trim function because I have an Address1 and Address2 field. The address 2 field most of the time is blank. Isn't the Trim function supposed to move up the City, State, and Zip fields when the Address 2 field is blank so there's no gaps in the address line? Also all the fields are set to Can Grow/Shrink but the VendorName field does not Grow when the name doesn't fit in the alloted space. I'm going bald this is so frustrating.
    Thanks,
    Deb

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Combining Text fields (2000)

    Trim only removes leading and trailing spaces from a string, it doesn't do anything with spaces within a string. We'd have to see the exact control source to give specific advice.

    When using Can Grow/Can Shrink, make sure that there is no vertical overlap between controls.

  7. #7
    4 Star Lounger
    Join Date
    Oct 2002
    Location
    Sayre, Pennsylvania, USA
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combining Text fields (2000)

    The text boxes weren't overlapping but they were touching so I separated them and it still didn't work. I've attached a copy of the report. rptCCMechExist. Thanks, Deb

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Combining Text fields (2000)

    The CanShrink property has no effect because there are other controls to the left of the Source block that are populated, and a box around the block that cannot shrink. The solution is to use one big text box, and to concatenate the parts of the address in the control source. Concatenating with + can be used to suppress a line if one of the constituent bits is null (blank). It ain't pretty, but it works:

    =Trim([txtVendorName]) & (Chr(13)+Chr(10)+Trim([txtVendorAddress1]) & (Chr(13)+Chr(10)+Trim([txtVendorAddress2]) & Chr(13) & Chr(10) & Trim([txtVendorCity] & ", " & [txtVendorState] & " " & [txtVendorZip]) & (Chr(13)+Chr(10)+"Phone: ")+[txtVendorPhone]) & (Chr(13)+Chr(10)+"Fax: ")+[txtVendorFax]) & Chr(13) & Chr(10) & ([txtVendorContactFirstName] & " " & [txtVendorContactLastName])

  9. #9
    4 Star Lounger
    Join Date
    Oct 2002
    Location
    Sayre, Pennsylvania, USA
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combining Text fields (2000)

    Thanks Hans,
    That worked, but so I understand how it all works. How does it know when to start on the next line? What does Chr(13) and Chr(10) mean? I also notice in front of the phone and fax fields you have a ) after the ", what's that for?
    Thanks,
    Deb

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Combining Text fields (2000)

    Chr(13) is the carriage return character, and Chr(10) the line feed character. The combination of those two is used by many applications to start a new line (carriage return/line feed or CrLf)

    I actually messed up the parentheses a bit, it should have been

    =Trim([txtVendorName]) & (Chr(13)+Chr(10)+Trim([txtVendorAddress1])) & (Chr(13)+Chr(10)+Trim([txtVendorAddress2])) & Chr(13) & Chr(10) & Trim([txtVendorCity] & ", " & [txtVendorState] & " " & [txtVendorZip]) & (Chr(13)+Chr(10)+"Phone: "+[txtVendorPhone]) & (Chr(13)+Chr(10)+"Fax: "+[txtVendorFax]) & Chr(13) & Chr(10) & ([txtVendorContactFirstName] & " " & [txtVendorContactLastName])

    Sorry about that.

  11. #11
    4 Star Lounger
    Join Date
    Oct 2002
    Location
    Sayre, Pennsylvania, USA
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combining Text fields (2000)

    Thanks for explaining that. I appreciate all your help. Deb

Posting Permissions

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