Results 1 to 10 of 10
  1. #1
    campanellisj is offline Novice
    Windows Vista Access 2007
    Join Date
    Sep 2010
    Posts
    11

    basic report help

    How can I have a reports text field say a different remark based on a selection in a form?



    For instance if the user selects option 1 from the main form the report says "option one selected", If he selects option 2 say "option 2 selected" etc etc...

    There are 5 options in total but I need the remarks in those options to show on the report based on user selection. I tried the IIF statement but that didn't work. Is this doable? The options are in tblOption and the dropdown is in tblMain

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Nested IIf() functions would work, as would the Switch() function, but what you should do is include the two tables in a query with a join on the option number field. That would enable you to bring in the descriptive value from the options table. Joining the tables is more efficient and more flexible (like when you change options).
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    campanellisj is offline Novice
    Windows Vista Access 2007
    Join Date
    Sep 2010
    Posts
    11
    Thanks for the fast response, I tried the nested approach and will look into the other two as soon as I post this. my issue again is that the options are actual paragraphs of text that are different depending on the option selected.
    I attahced the DB to this, it's really basic only the two tables and the report. appreciate your help!

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I expected to see the exception id or code in the main table. How do you determine which exception to put on the report without that?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    campanellisj is offline Novice
    Windows Vista Access 2007
    Join Date
    Sep 2010
    Posts
    11
    I cleared it out cause I couldn't get it to work, I know thier should be an FK key there I must have just forgotten it. please add it in again.

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    So I have to do your work for you?

    SELECT tblMainAttrsImport.Course, tblMainAttrsImport.Class, tblMainAttrsImport.SSN, tblMainAttrsImport.Name, tblException.Exception
    FROM tblMainAttrsImport INNER JOIN tblException ON tblMainAttrsImport.ExceptionID = tblException.ExceptionID;
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    campanellisj is offline Novice
    Windows Vista Access 2007
    Join Date
    Sep 2010
    Posts
    11
    I'm sorry to be a bother, it's just a lil thing I was playing with nothing "work" related just an internal tool. I appreciate your help I really do.

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No bother, I was just kidding around. Did that SQL solve the problem?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    campanellisj is offline Novice
    Windows Vista Access 2007
    Join Date
    Sep 2010
    Posts
    11
    No I guess I can't do what I am thinking or I don't understand. I need the report to look at the installation field, see "polk" then display the polk exception (or it sees bragg and displays a different exception memo)

    the users select the installation in a form but I wanted to create the report in such a way that the system saw the installation selected and displayed the standard memo field for that installation.

    the exceptions themselves are quite lengthy but each one is different per installation. So the switch() doesn't work and the nestedIIF won't work cause of the length of all the different memo fields (not to mention the amount of installations avalible lol)

  10. #10
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    But when you say "see 'polk'", how is it supposed to see it? You would typically have a field that the two tables share, which is why I said I expected to see ExceptionID in the main table. Your original question was about how to display the text associated with the choice, but you aren't storing the choice, so how would you even do it with an IIf()? If you want to base it on the Installation field, then that field should be the key field in the exceptions table (or at least be a field in the table, so they can be joined).
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Basic report programming question.
    By sepoto in forum Programming
    Replies: 1
    Last Post: 04-06-2011, 07:45 PM
  2. Very new to VBA, could use some basic help
    By oregoncrete in forum Programming
    Replies: 13
    Last Post: 03-24-2011, 09:30 AM
  3. Basic Questions
    By jlclark4 in forum Access
    Replies: 6
    Last Post: 12-13-2010, 12:09 PM
  4. Very Basic DB (Relationships)
    By SilentPirate007 in forum Database Design
    Replies: 4
    Last Post: 06-06-2010, 01:25 PM
  5. Basic help linking data to a report?
    By SportyDog in forum Reports
    Replies: 3
    Last Post: 11-30-2009, 02:26 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