1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: Access 2007 Trim and field text addition

Discussion in 'Business Applications' started by BigAlMonroe, Mar 5, 2013.

Thread Status:
Not open for further replies.
Advertisement
  1. BigAlMonroe

    BigAlMonroe Thread Starter

    Joined:
    Mar 5, 2013
    Messages:
    8
    I created a form letter as an Access 2007 report. The only field is [first_name] from a query. The first line reads, "Dear Joe (or whatever [first_name] is). I want a comma after each name. I tried =Trim([first_name] & ","), =Trim([first_name) & "," and every combination I can think of. Every permutation returns Dear #Type!. How can I get Dear followed by the name and a comma? Thanks!
     
  2. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    BigAlMonroe, welcome to the Forum.

    Try
    =([first_name] & ","
    or
    =([first_name] & ", "
     
  3. BigAlMonroe

    BigAlMonroe Thread Starter

    Joined:
    Mar 5, 2013
    Messages:
    8
    Hi,
    I don't give up either, but those answers didn't work. They return a "missing (, [ or |" error. I tried adding a closing ) to no avail. I know I've done this in Access 2002 a zillion times. I'm even copying the format from a QUE book. *sigh*
     
  4. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    Sorry remove the (
    =[first_name] & ","

    I forgot to do so.
     
  5. BigAlMonroe

    BigAlMonroe Thread Starter

    Joined:
    Mar 5, 2013
    Messages:
    8
    Been there, done that, but I tried it again. Works fine with just the field and no additions, but there HAS to be a way to do this! Thanks for taking your time. Any more suggestions, I'll try them!
     
  6. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    I just used
    =[CoName] & ","
    in another forum poster's database and it worked fine.
    Can you post a copy of yours?

    I take it you are using an Unbound Text box?
     
  7. BigAlMonroe

    BigAlMonroe Thread Starter

    Joined:
    Mar 5, 2013
    Messages:
    8
    Had to leave for awhile; our power went out. The box is bound to a query field. Forgive my innocence, but, being new here, I'm not sure what you mean by posting a copy; you mean somehow posting a copy of the db?
     
  8. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    You can attach a zipped copy of the database (less any personal data) on the forum using the "Go Advanced" and "Manage Attachments" buttons.
    I would compact & repair the database before zipping to make it as small as possible.
     
  9. BigAlMonroe

    BigAlMonroe Thread Starter

    Joined:
    Mar 5, 2013
    Messages:
    8
    Hi, Went home for the night before seeing your reply. As soon as our IT guy gets WinZip, I'll do as you say. Thanks!
     
  10. BigAlMonroe

    BigAlMonroe Thread Starter

    Joined:
    Mar 5, 2013
    Messages:
    8
    Here you go!
     

    Attached Files:

  11. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    It is the report that is the problem, I cannot get it to accept any unbound field with =first_name, but I created a new report and it works fine.
    See Planner_Winners_Query_All
     

    Attached Files:

  12. BigAlMonroe

    BigAlMonroe Thread Starter

    Joined:
    Mar 5, 2013
    Messages:
    8
    Hi OBP,
    Our new firewall won't allow me to download the file and our IT person can't fix it. If I send you my e-mail address, can you send it to me?
     
  13. BigAlMonroe

    BigAlMonroe Thread Starter

    Joined:
    Mar 5, 2013
    Messages:
    8
    Found the problem in another forum:
    1. Make sure that your text box is NOT named first_name (which it likely is as that is the Access default way of naming the controls - it uses the field name it is bound to.

    2. If the field is used in an expression, the name of the text box needs to be changed as mentioned in number one so I would use txtFirstName or something like that. Then you use the FIELD name in the expression (name autocorrect, unless you have wisely turned it off, will automatically change the expression to use the text box name you changed and you would need to change it back to the field name).

    So,

    ="Dear " & [first_name] & ","

    would be the correct syntax for the text box control source.
     
  14. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1091945

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice