Results 1 to 8 of 8
  1. #1
    2 Star Lounger
    Join Date
    Jul 2002
    Location
    Sacramento, CA
    Posts
    193
    Thanks
    3
    Thanked 1 Time in 1 Post
    I have a modal/popup Main form with a command button to open a second form in modal/popup mode. The second form has a command button to Preview a report. The command button code sequence is:

    Mainform.visible=false

    Popupform.visible=false

    OpenReport in Preview mode

    DoEvents loop until report is closed

    Mainform.visible=true

    Popupform.visible=true


    My problem is I can not make both forms visible again. Which ever form is set to visible first is the only form which is made visible. I've tested this by rearranging the order of two visible=true statements. I've also tried Docmd.Openform instead of setting the visible property and get the same result, only the form in the first statement is visible.



    I can get around this by setting the visible property in the Close event of the Popup form, but it seems like I should be able to do it all in one place. Is there something I need to do between the two visible=true statements?

    Marty


  2. #2
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Brisbane, Queensland, Australia
    Posts
    387
    Thanks
    0
    Thanked 1 Time in 1 Post
    Controlling interface flow can be challenging and there are many different approaches.

    There are so many wasys to control interface flow so here are a couple of tips.

    Have you made the forms Modal at design time?

    A much better way, is to open them as modal.

    Code:
    DoCmd.OpenForm "frmModal", , , , , acDialog
    'do something when frmModal closes
    When you do this the code stops and passes to the opened form. The next line won't execute until the opened form closes.

    I only ever use this when there is a specific action required by the user before the process on the parent form can be completed.

    Opening reports in preview from a modal form presents considerable challenges but I can't think of a situation where a user must read a report before they can continue work.

    In a situation like, for example where the data doesn't balance, it's better to handle that with a form.

    When I ever end up in a process like yours, where I have more than one form modal at a time, I take a relook at the workflow and invariable come up with a better process.

    By the Way - popup is something I only ever use if I want a little form to float outside of the Access window. You might find you don't need to set the form's popup property to true.

  3. #3
    2 Star Lounger
    Join Date
    Jul 2002
    Location
    Sacramento, CA
    Posts
    193
    Thanks
    3
    Thanked 1 Time in 1 Post
    Thanks for the thoughts, I didn't realize code waits when a form is opened with acDialog.

    Regarding opening a report in preview from a modal form, the form does need to be modal to allow the user to manage the status of many transactions, which is just one step in a multi-step workflow being managed by the Main form. My first thought was to capture the datasheet recordset (with the filters and sorts the user has set), but I have not found a way to do that. So in lieu of the recordset capture, I'm Previewing a report in 'Report' mode to allow the user to set his own filters prior to printing.

  4. #4
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Brisbane, Queensland, Australia
    Posts
    387
    Thanks
    0
    Thanked 1 Time in 1 Post
    What about using a continuous form with combo boxes in the header for filtering and command buttons in the header above each column to sort. You can then track the current filters and send them to the report in the criteria. You can use the open arg to send the sort order to the open event of the report
    Code:
    strArg = "Batch_Date DESC"    
    strCriteria = "Batch_Date >= #" & dteFrom & "# AND Batch_Date <= #" & dteTo & "#"
    DoCmd.OpenReport "rptBatch", acNormal, , strCriteria, , strArg

  5. #5
    2 Star Lounger
    Join Date
    Jul 2002
    Location
    Sacramento, CA
    Posts
    193
    Thanks
    3
    Thanked 1 Time in 1 Post
    I've thought about that, but the datasheet view provides really rich filter options based on column type and actual data, I hate to give this up. Along the same lines as your suggestion, I did discover I can capture the datasheet applied filters through its Filter property and use this value in the OpenReport's Where clause. Now working on how and where best to clear any previous report filter. But I think with this approach I can skip using 'Report' View as it seems to cause the report Close event to fire at what seems to me unexpected times. Have been searching but not found any description yet of Report View event s order.

  6. #6
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,624
    Thanks
    3
    Thanked 60 Times in 60 Posts
    Actually, I believe you have much the same filter and sort options on a continuous form as you have on a datasheet view - have you found something to the contrary?
    Wendell

  7. #7
    2 Star Lounger
    Join Date
    Jul 2002
    Location
    Sacramento, CA
    Posts
    193
    Thanks
    3
    Thanked 1 Time in 1 Post
    Wendell,

    You're right. The one difference seems to be with a datasheet there is the down arrow in the column label, which when clicked opens a pop-up form/dialog listing all the individual values in the column. In my situation this is very handy for the user. I don't believe there is a similar capabiltiy with continuous forms, or am I overlooking something?

    Marty

  8. #8
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,624
    Thanks
    3
    Thanked 60 Times in 60 Posts
    You are correct about that filtering capability - although it only works on columns with a limited number of entries, and how many seems to be an unanswered question. If you are using a lookup table, then you can provide a similar capability using a combo box that gives the choices a user has to do the filter, but it doesn't provide the little check-box that the built-in dialog gives you.
    Wendell

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •