Results 1 to 8 of 8
  1. #1
    kestefon is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2013
    Posts
    108

    How to Create Dynamic Report with Changing View?

    Hi,



    I have a master recordset containing sales data for numerous products. I'd like to create a dynamic "dashboard" (i.e. a single report or form that the user can interact with dynamically) where the user can click a product name from a ListBox and see a summary report generate in the space below. If they click a different product name from the ListBox, I'd like the report space to automatically refresh and show the next summary report.

    Could someone outline the steps involved with this? I've created my desired report and dragged it into the form but I'm having trouble embedding it dynamically into the form: I tried using the "Link Child Fields"/"Link Master Fields" properties, but get an error message saying I can't build a link between unbound forms. Here's a screenshot to give you an idea of what I'm trying to accomplish. Thanks!

    Click image for larger version. 

Name:	AccessScreenshot.png 
Views:	15 
Size:	34.9 KB 
ID:	16760

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    In the list box AFTER UPDATE event, requery the subform.
    me.child1.requery
    (if you have no links, dont embedd the report, just open it)

  3. #3
    kestefon is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2013
    Posts
    108
    Thanks. What do you mean when you say "don't embed the report, just open it"? I'd like the report to be embedded within the overall form, and then requeried whenever a new ListBox item is selected...

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    It would not be a box on the form,
    it would be a button to run the command : docmd.openreport "rMyReport",acViewPreview
    (the query in the report is looking at the list box on the form)

  5. #5
    kestefon is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2013
    Posts
    108
    Cool. I was able to add a button and generate a report preview, but I seem to have the requery syntax wrong. I'm supposed to add VBA code to the ListBox and use the requery method? Should the requery method refer to the name of the button?

  6. #6
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    No, the requery was for the sub form. dont need it now.

  7. #7
    kestefon is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2013
    Posts
    108
    Gotcha. I added a DoCmd.Close line to the query on the button so that it would close and re-open the preview if someone selects a new product.

    One more question: While this more or less gets me where I want to go, is there anyway to have the preview integrated within the actual form, instead of as a pop-up?

  8. #8
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    The subform/report as you originally had. (no child / no master links)
    The rpt query is linked to the form list box.
    The child.requery will be needed when they select a diffenent item in the list.

    But they are stuck in your little window provided.

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

Similar Threads

  1. Changing field value in report view in access
    By tanyapeila in forum Queries
    Replies: 2
    Last Post: 03-17-2014, 01:31 PM
  2. Replies: 3
    Last Post: 02-15-2014, 02:59 AM
  3. CREATE VIEW syntax for linked SQL view
    By DavidT in forum SQL Server
    Replies: 2
    Last Post: 10-17-2013, 02:48 PM
  4. Replies: 1
    Last Post: 01-18-2013, 12:32 AM
  5. counting columns of table to view in dynamic recordset
    By rivereridanus in forum Programming
    Replies: 3
    Last Post: 07-27-2011, 02:44 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