Results 1 to 12 of 12
  1. #1
    ceb39usa is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Sep 2013
    Location
    San Francisco
    Posts
    8

    Question How and when to place parenthesis around a field in a report

    I have written a report for printing name badges for an up coming class reunion.

    Everything is in the correct place and the out put is good, except for one thing.

    I would like to place parenthesis around the maiden names of the women who
    will attend the reunion and are married, but not have the parenthesis appear
    if the MaidenName field is blank for a male.

    This problem has had to been solved multiple times, but I have not found an
    answer on any of the internet searches I have performed.

    The source of the data which is being used for the printing, is a query which
    selects only those classmates who are planning on attending the reunion.

    Any help or suggestions would be appreciated.



    Thanks

    ceb39usa

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    An IIF statement in your query would probably do it.

  3. #3
    ceb39usa is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Sep 2013
    Location
    San Francisco
    Posts
    8
    Gave this a shot and it did not produce the desired results.

    IIf([MaidenName]="IsNull",[MaidenName]=" ",([MaidenName]=("("+[MaidenName]+")")))

    Not certain the IsNull is configured correctly. Just trying to determine if there is anything in the MaidenName field.
    If there is nothing there, leave it alone. If a name is there, place parenthesis around it and put it back in to the
    MaidenName field for that record.

    Thanks

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Are you just trying to make an Update query?

  5. #5
    ceb39usa is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Sep 2013
    Location
    San Francisco
    Posts
    8
    Not really. The results of the query can stay the same. Just want to print parenthesis
    around the Maiden Name which it is printed out on the report I produce. That report
    is going to be printed on Avery Badge Stock to make the badges. So if the Maiden
    Name on the badges has parenthesis around it I am satisfied. Now that I think about it
    I guess I do not want anything to change, i.e. an Update Query.

    Thanks

    ceb39

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Try:
    IIf(Len([MaidenName] & "") = 0, " ", "(" & [MaidenName] & ")" )

  7. #7
    ceb39usa is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Sep 2013
    Location
    San Francisco
    Posts
    8

    Smile Reunion lables

    Quote Originally Posted by RuralGuy View Post
    Try:
    IIf(Len([MaidenName] & "") = 0, " ", "(" & [MaidenName] & ")" )
    Success!

    Placed this code into the MaidenName field in the query and it did not work.

    Then placed it into the Control Source for MaidenName in the report I am producing
    and it worked.

    Can you explain what is going on with this piece of your code, & "") = 0.
    I understand it is the expression being evaluated, but do not quite understand
    the evaluation process. The true and false statements I can understand.

    Thank you for your help. Now I can show the women who made labels for the
    last reunion that cutting and pasting (literally doing it that way) with her MAC that
    there is another way to do it faster (less than thirty seconds), and cleaner.

    What surprises me is, that I could not find anything on the internet to produce name
    labels for some type of event like a class reunion.

    Now mine show the header for the event, a small image for the school mascot, a
    photo of the classmate, and their names below it all.

    Again thanks for all your help.

    Chuck

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Quote Originally Posted by ceb39usa View Post
    Can you explain what is going on with this piece of your code, & "") = 0.
    I understand it is the expression being evaluated, but do not quite understand
    the evaluation process. The true and false statements I can understand.

    What surprises me is, that I could not find anything on the internet to produce name
    labels for some type of event like a class reunion.
    I figured [MaidenName] could be either a Null or a ZeroLengthString (ZLS). The code: ([MaidenName] & "") concatenates a ZLS with whatever is in [MaidenName] and then Len([MaidenName] & "") checks the length of the result. This covers both a ZLS and a Null field in one expression.

    Maybe you want to place your code in the public domain (by posting it here) so others can use Google to find it. Glad you got it working.

  9. #9
    ceb39usa is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Sep 2013
    Location
    San Francisco
    Posts
    8
    Thank you for the explanation. I doubt if I would ever had figured that out without your help.

    I have a couple of Access books, but none even come close to discussing this. The Special Addition of "Using Microsoft Access 2007" by Que
    is what I usually use, but I did not find any related to this subject.

    Next question. Since I am new to this forum, how do I place this code into the public domain?

    Thanks again.

    ceb39usa

  10. #10
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Just by posting your code solution on a post in this thread will do it.

  11. #11
    ceb39usa is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Sep 2013
    Location
    San Francisco
    Posts
    8
    Have run into a strange situation.

    The fix you recommended is running on my desk top with Access 2007. Maiden names are being surrounded by parenthesis when needed.

    Copied everything to a flash drive and then copied it to my new laptop running Office 365 2013.

    All queries work fine.

    The report which show just female attendees to the reunion shows the following in the Maiden Name field, #Name? where the maiden name is supposed to be.

    Double checked the query code and there appears to be nothing wrong it, basically just like the code for males. The code which places the parenthesis around the
    maiden name is in the field for the report.

    Even stranger. Print the report for all deceased classmates. This report shows male and female as I am not too concerned how the names are placed
    on this report. When this report is shown the male names are correct and the female names are correct, i.e. for a married female her maiden name is
    in parenthesis. So the code is not printing a maiden name when there is nothing in that field for a record, i.e. a male, and is printing a maiden name
    in parenthesis if the female classmate was married and her maiden name is the MaidenName field for that record.

    For the life of me I can not figure out why this is occurring.

    It is not a big deal as the printer I am going to use to print the badges is attached to my desktop running Access 2007. Just wanted to
    run the report on my laptop correctly if I took the laptop anywhere.

    Any ideas?

    Thanks

    ceb39usa

  12. #12
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I'm sorry but I have no experience with Office 365 so I have no guesses on your issue.

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

Similar Threads

  1. Replies: 9
    Last Post: 08-20-2013, 09:59 AM
  2. Can you place Multiple Field Names to a Single Index?
    By VanillaAwesome in forum Access
    Replies: 2
    Last Post: 08-05-2012, 04:40 PM
  3. Replies: 9
    Last Post: 06-04-2011, 04:07 AM
  4. Missing a parenthesis somewhere in query
    By johnmerlino in forum Reports
    Replies: 12
    Last Post: 12-21-2010, 08:34 AM
  5. Replies: 1
    Last Post: 05-21-2009, 08:13 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