Results 1 to 6 of 6
  1. #1
    RoosterD is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2011
    Posts
    2

    chr(13) & chr(10) not working in my report

    Hello all, I just started working on our companies access database 2003. We're moving to office 2010.

    When printing a purchase order we have a print preview button that displays a report. The code for the "ship to" address works fine in 2003:

    =[Companies.CompanyName] & Chr(13) & Chr(10) & [Companies.Address1] & Chr(13) & Chr(10) & [Companies.City] & ", " & [Companies.Region] & " " & [Companies.PostalCode] & Chr(13) & Chr(10) & "Phone: " & [Companies.Phone1] & Chr(13) & Chr(10) & "Fax: " & [Companies.Fax]

    However, in 2010 I get this very informative #Type! message. I've tried using vbCrLf and vbNewLine to no avail. Basically it thinks vbCrLf is a variable and adds [vbCrLf] to it; I even tried <BR>... . Then when I go into report view it asks for a value for the parameter.

    Any help is greatly appreciated! I've been at this for a while testing different things.

    Dave in Sacto

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Does it work if you reverse the codes: Chr(10) & Chr(13)? Seems I encountered that, just can't remember which way I reversed. Don't have 2010 here (it's at home) but just tested in 2007 and this reversal fails. Can't imagine 2010 would be different. Can't see anything wrong with that expression. Try a simpler expression in another textbox, like "Test" & Chr(13) & Chr(10) & "test". Does it still fail?

    You could just use separate textboxes for each piece of data instead of the concatenation into one.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    RoosterD is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2011
    Posts
    2
    Quote Originally Posted by June7 View Post
    Does it work if you reverse the codes: Chr(10) & Chr(13)? Seems I encountered that, just can't remember which way I reversed. Don't have 2010 here (it's at home) but just tested in 2007 and this reversal fails. Can't imagine 2010 would be different. Can't see anything wrong with that expression. Try a simpler expression in another textbox, like "Test" & Chr(13) & Chr(10) & "test". Does it still fail?

    You could just use separate textboxes for each piece of data instead of the concatenation into one.
    I was thinking the same thing. I tried separate text boxes and found that it worked fine except for longer names. So either it cuts off the last part of the name (fine by me, but not others) or set can grow at which point the subsequent boxes over lap the rest of the page. I appreciate the help. I'll try the reverse, but I seem to remember trying that. Can't hurt to try it again. Thank you

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Why can't you make the boxes wide enough to display the longest values?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    It is Chr(13) & Chr(10) (the larger one always comes before the smaller in this case - the reason is the Carriage Return must come before the Line Feed and it is logical if you think about what those meant to a printer).

    What happens if you use this instead:
    =[CompanyName] & Chr(13) & Chr(10) & [Address1] & Chr(13) & Chr(10) & [City] & ", " & [Region] & " " & [PostalCode] & Chr(13) & Chr(10) & "Phone: " & [Phone1] & Chr(13) & Chr(10) & "Fax: " & [Fax]

    without the table references.
    Last edited by boblarson; 06-20-2011 at 12:35 PM. Reason: add info

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    I've also had success preceeding the sequence with a space " " so you end up with & " " & vbCrLf.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Working with PDF's
    By Mitch87 in forum Access
    Replies: 1
    Last Post: 02-19-2010, 11:24 AM
  2. Report "WHERE" clause not working
    By rsearing in forum Reports
    Replies: 4
    Last Post: 05-26-2009, 02:07 PM
  3. 07 Switchbox Not Working! - please help
    By techexpressinc in forum Access
    Replies: 16
    Last Post: 05-05-2009, 09:36 AM
  4. Why isn't this working?
    By adiecidue in forum Queries
    Replies: 4
    Last Post: 04-27-2009, 10:29 AM
  5. public instead of dim not working
    By DKY in forum Access
    Replies: 1
    Last Post: 10-14-2008, 11:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums