Results 1 to 13 of 13
  1. #1
    3 Star Lounger
    Join Date
    Sep 2002
    Location
    London, England
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Can a form 'un-modal' itself (2000)

    I'm struggling to get report previews to open on top of rather than behind my forms. Can a modal form 'un-modal' itself, then call a report? If not, is there a way of setting up/opening a form so that it opens to the size that I saved it and sits on top of other open forms but does not stay in front of report previews?

    Ian

  2. #2
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Can a form 'un-modal' itself (2000)

    Does your form really have to be modal at all.
    Can't it be pop-up instead ?

    I use the following procedure with my reports:-

    Private Sub Report_Open(Cancel As Integer)
    Forms!frmYourForm.Visible = False
    End Sub

    Then on close use

    frmYourForm.Visible=True

    Change frmYourForm to your pop-up form name.

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Can a form 'un-modal' itself (2000)

    You asked the same question in <post#=243442>post 243442</post#>, and Dave gave you essentially the same advice you got there too: hide the form while showing the report.

  4. #4
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Can a form 'un-modal' itself (2000)

    Perhaps a better explanation of how you are using your forms and "Why" they have to be modal.

    There may be a different work around for your scenario.

  5. #5
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Can a form 'un-modal' itself (2000)

    Try this, but set to true when the report closes.

    Private Sub Report_Open(Cancel As Integer)
    Forms!frmYourForm.Modal = False
    Forms!frmYourForm.Visible = False
    End Sub

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Can a form 'un-modal' itself (2000)

    Hey, that's a neat trick - I didn't know that you could set the Modal property while the form is open!

    However, I think that IanR is confusing modal and popup. As I pointed out in the other thread, it is the PopUp property being set to True that makes a form float over other database objects and keeping its size even when other forms are maximized. The PopUp property can not be changed while a form is open.

    Another way to keep a form from being resized is to set its Border Style property to Dialog.

  7. #7
    3 Star Lounger
    Join Date
    Sep 2002
    Location
    London, England
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Can a form 'un-modal' itself (2000)

    Partial success. And yes I am being loose with my language. I am opening all my forms from code and the ones that I am describing as modal are opened with the acDialog setting, so they are modal and pop-up. Is there an easier way of saying this?

    Following Hans and Dave's guidance I have experimented with hiding the calling form from the Open event of a report, then setting the form back to visible = True on the Close event of the report. This works in that the report now opens on top but has introduced another problem. By the time the user's get to this report there are are other forms open behind the acDialog one. These are not pop-up, not modal and are maximised. However, after closing the report, these 'normal mode' reports are no longer maximised. Somehow either closing the report or toggling the Visible property of the acDialog form has unmaximised all the other open forms. The report opens maximised. Any idea why the other forms are affected and how to stop them changing size?

    Ian

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Can a form 'un-modal' itself (2000)

    I would call a form opened with acDialog a dialog form or a form in dialog mode. This time, you're mixing up forms and reports <img src=/S/grin.gif border=0 alt=grin width=15 height=15>.
    I don't know if you can prevent forms or reports from being "restored" in size; you could put DoCmd.Maximize in their OnActivate events (and perhaps DoCmd.Restore in their OnDeactivate events).

  9. #9
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Can a form 'un-modal' itself (2000)

    I had a similar problem with this in the past and got around it by putting:

    DoCmd.Maximise in the Open,Load and resize properties.

    Works for me !!

  10. #10
    3 Star Lounger
    Join Date
    Sep 2002
    Location
    London, England
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Can a form 'un-modal' itself (2000)

    Hi Hans,

    I've re-read my post and I don't think I'm mixing up forms and reports. At the stage at which the report is open I have, reading down from the report:

    The report
    The dialog form that opened the report
    A submenu, non modal non pop-up, maximised
    A main menu, non modal non pop-up, maximised

    What's causing the problem is the two maximised forms at the bottom of the stack. Why should these be affected by the be what goes on above them? Interestingly, it appears to be the reappearence of the dialog form that causes the trouble. If I comment out the code on the close event of the report, that resets the visible property of the dialog form, the other forms stay maximised. Which is great except that the users can no longer see the dialog form.

    Is it time to start pulling out my hair?

  11. #11
    3 Star Lounger
    Join Date
    Sep 2002
    Location
    London, England
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Can a form 'un-modal' itself (2000)

    Hi Guys,

    Om my resizing problem, I've tried your suggestions and they don't work. In particular, puttingDoCmd.Maximise in the onResize events of the problem forms seemed to work just right (and I was about to try and find out how to add one of those smiley icons to my thankyou note) but then my application started crashing. Looking at Help I found a warning to watch out for cascading events if you put a resizing command in a resize event, which makes perfect sense. I suppose it would, wouldn't it? What I don't understand is why it sometimes works at all.

    I am resigned to non-maximized menus behind my order forms and invoices now. Thanks for suggesting the solution to the main problem - hiding the modalforms when the report opens - this works a treat.

    However, just for my own curiosity, can anybody throw some light on why changing the visibility of a form causes all the other forms on the screen to 'restore down' (as it is described on my XP system when I hover over the unmaximise button). Just to remind, the forms I had open were:

    The report
    The dialog form that opened the report
    A submenu, non modal non pop-up, maximised
    A main menu, non modal non pop-up, maximised

    Resetting the dialog form to Visible = True on closing the report resized my other two forms.
    I guess this is Windows behaviour rather than Access but I would be interested to know what is going on.

    Ian

  12. #12
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Can a form 'un-modal' itself (2000)

    Ian
    Is it imperative that your report menu still be visible once the report has closed ?

    Another way to achieve what you want is to actually close the popup modal form instead.

    I've put a very rough demo here to show what I mean.
    Are your users viewing report after report after report ......................

    If not, then I don't see any real need for the popup to always be there.
    Attached Files Attached Files

  13. #13
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Can a form 'un-modal' itself (2000)

    Here is another rough example, much like Dave's.

    It demonstrates the difference between opening a popup form and a dialog form. Not that the two buttons on the menu form actually open the same form; the only difference is that the second button uses WindowMode:=acDialog. When you close the report, forms will be restored only in the second case.
    Attached Files Attached Files

Posting Permissions

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