Results 1 to 10 of 10
  1. #1
    djrickel is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Feb 2014
    Posts
    21

    Life Expectancy tbl will display on rpt beginning with client age

    First of all, THANK YOU in advance for your help with this. You guys are awesome as this forum has been a huge help to me.



    Originally, we created a large Word document that linked to Excel many, many, MANY times but had nothing but problems with the links causing each object to embed instead of being dynamically linked--forcing tons of constant rework. Often, the Word document and Excel workbooks would corrupt so badly that neither could be re-opened. So I concluded that dynamic links work great in theory but not in real life, especially in large quantities.

    Now, I have a database that will print off a series of reports mimicking each page of the Word document, each one dependent on a certain field or two from the Client table.

    Here's my dilemma: (see the sample Word document) The big issue is how to recreate the life expectancy table on an Access report that begins with the client's current age to show how long the client could potentially live.

    I assume this would be a subreport pulled from a Life Expectancy table? But how to get the subreport to format the same way? The idea is to get this subreport to look like a snapshot of a life expectancy table beginning with the client's current age.
    Attached Files Attached Files

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Need to know more about data structure. Do you have a table of life expectancy records? Build subreport of that table and apply filter criteria to the Age column: >= [input Age value here]

    The filter parameter can be a dynamic popup in query (I never do this) or can be reference to a textbox on a form or even the client's calculated age in the main report RecordSource.

    If you don't have this table, there are methods to generate these records for report but involve quite a bit of VBA 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.

  3. #3
    djrickel is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Feb 2014
    Posts
    21

    Attached DB

    Sorry...just attached the database with the Client and Life Expectancy tables.

    If you look carefully at the sample Word document, the table appears in two columns of Age and Year. Excel can do this but I can't figure out how to format this in Access.

    Thanks again for your help.
    Attached Files Attached Files

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Two sets of columns for Age and Expectancy is a multi-column report. This is a design setting of report. With report open in Design or Preview, look at the Columns tool on the Page Layout section of ribbon. However, I think must done on main report, not a subreport. Which means cannot have text info next to the columns as shown in the pdf.

    Alternatives require VBA 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.

  5. #5
    djrickel is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Feb 2014
    Posts
    21
    That worked! Thank you!

  6. #6
    djrickel is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Feb 2014
    Posts
    21
    Oops. No it didn't. When I link the form and subform based on the client's current age, the subform only returns one line for the current age. Excel solves this with a VLOOKUP. Help!

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Did you mean report/subreport?

    I did say multi-column probably work only on main report.

    But why are you linking on age? Age must be filter criteria, not a link.
    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
    djrickel is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Feb 2014
    Posts
    21
    The multi-column subreport does work if it is not linked or filtered. As soon as I do a master/child thing or a filter then all I see is the one row that matches the client's current age. From the sample I attached, you will see that it is a table snapshot beginning with the client's current age. How can I replicate the Vlookup done in Excel to create that in Access?

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Don't understand why filter won't work. What did you use? Age>= [client age]

    The only alternatives I can suggest involve a lot of VBA.
    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
    djrickel is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Feb 2014
    Posts
    21
    OMG. The littlest things hang you up....

    I had only used = and >= !!!! Thank you so much. It works now.

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

Similar Threads

  1. The Golden VB Script that will make your life much easier
    By pkstormy in forum Code Repository
    Replies: 55
    Last Post: 04-14-2015, 12:08 PM
  2. Replies: 2
    Last Post: 10-03-2013, 01:01 PM
  3. Replies: 2
    Last Post: 08-14-2013, 01:41 PM
  4. A life jacket please
    By vampire12 in forum Access
    Replies: 6
    Last Post: 06-13-2013, 02:11 PM
  5. Replies: 1
    Last Post: 07-26-2011, 06:10 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