Results 1 to 13 of 13
  1. #1
    imran688 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    30

    Create a paragraph using Field Values

    Hi fellows,
    How can I use different fields values to compose a paragraph?
    I want to make a shipment notification letter using different fields. For Example,



    Hi [ShipToName],
    Your order of book [BookName] has been shipped via [Shipping_Service]. The tracking No. is [TrackingNumber].
    Your order has been shipped to following address,
    [ShipToName]
    [Street1]
    [Street2]
    [City], [State] [ZIP],
    [Country]

    Then I also want to email it using outlook 2010 but that might be a different thread.

    Regards,
    Imran

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    Use expression in textbox or VBA code that concatenates literal text with the variable field data, like:

    ="Your order of book " & [BookName] & " has been shipped via " & [Shipping_Service] & ". The tracking No. is " & [TrackingNumber] & "." & Chr(13) & Chr(10) & "Your order has been shipped to following address:" & Chr(13) & Chr(10) & [ShipToName] & Chr(13) & Chr(10) ... you finish it

    If the expression is too long for textbox ControlSource, then use multiple textboxes.

    If you build the string in VBA, expression length is not an issue. And can use vbCrLf in place of the Chr(13) & Chr(10) codes.

    For email review
    http://forums.aspfree.com/microsoft-...ro-447084.html
    https://www.accessforums.net/program...ook-21903.html
    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
    imran688 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    30
    That was really helpful but expression field is not accepting & Chr(13) & Chr(10) and reverts back to last saved expression when used these symbols.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    Very odd. I have no problem using them in a textbox ControlSource expression. Show your complete expression.

    My example was missing an & in front of the [ShipToName] field.
    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
    imran688 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    30
    Quote Originally Posted by June7 View Post
    Very odd. I have no problem using them in a textbox ControlSource expression. Show your complete expression.

    My example was missing an & in front of the [ShipToName] field.
    O ic. I thought you told me to put that expressions in a calculated field. Now i get it, i should use a text box on form and set its ControlSource expression like this. right?

  6. #6
    imran688 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    30
    Do you have any idea how can I email this paragraph to an email address in Email_Address field in same table?

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    Did you review the links in post2 about email?

    Start another thread if you have issues with attempt to code.
    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.

  8. #8
    imran688 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    30

    I tried but New line is not working

    I am using the text to generate this test. The control source is set following code but chr(13) & Chr(10) does not seem to enforce a new line.
    ="Hello " & [ShipToName] & Chr(13) & Chr(10) & "Your order " & [ReferenceID] & " has been processed and shipped via " & [Shipping] & "."

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    Don't know why that is not working in the textbox ControlSource.

    Want to provide db for analysis? Follow instructions at bottom of my post.
    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.

  10. #10
    imran688 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    30

    any alternative?

    Quote Originally Posted by June7 View Post
    Don't know why that is not working in the textbox ControlSource.

    Want to provide db for analysis? Follow instructions at bottom of my post.
    Is there any alternative so that I can achieve the desired results using vba. In the control source I can only access expression builder. How I can I set text box's value using vba?

  11. #11
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    In code behind form that includes the textbox:

    Me.textboxname = "Your order of book " & [BookName] & " has been shipped via " & [Shipping_Service] & ". The tracking No. is " & [TrackingNumber] & "." & vbCrLf & "Your order has been shipped to following address:" & vbCrLf & [ShipToName] & vbCrLf ...

    The trick is figuring out what event to put the code in.

    The expression in textbox should work unless it is too long. There is a limit to number of allowed characters in ControlSource property.
    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.

  12. #12
    imran688 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    30
    It started working as i selected the text format to plain text. Thanks for support.
    Can you please give me a link to complete character code chart. I also wants to include "Tabs" in my text.

  13. #13
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    Google: ASCII code chart

    Try vbTab. I don't know what the Chr() equivalent would be. Can't find any reference that indicates there is one.

    Review: http://www.ehow.com/how_8203280_chec...acter-vba.html
    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.

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

Similar Threads

  1. Replies: 20
    Last Post: 09-12-2012, 06:52 PM
  2. Replacing many values at once in a multiple values checkbox field.
    By ConfusedDatabaseDesigner in forum Forms
    Replies: 2
    Last Post: 07-20-2012, 08:58 AM
  3. Pull maximum dollar amount in a paragraph
    By WSUAccess in forum Queries
    Replies: 5
    Last Post: 09-26-2011, 01:31 PM
  4. Replies: 33
    Last Post: 06-17-2009, 10:22 AM
  5. Paragraph
    By supatsiri in forum Reports
    Replies: 0
    Last Post: 02-06-2009, 10:05 PM

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