Report hiding behind forms (1 Viewer)

AlexN

Registered User.
Local time
Today, 20:04
Joined
Nov 10, 2014
Messages
302
Hi again,
I hate asking questions every step of the way but I'm really stuck with this (again).

I have a couple of forms open in dialog mode. Last one (the one in front), has a command button to open a report.
Problem is :
When I open the report in WindowNormal mode, it opens behind the forms and I have to close them to reach it.
When I open the report in Dialog mode, it opens in front alright but, I don't get the report ribbon and can't proceed to printing.
Tried closing the forms on opening the report and reopening them on report's close but it became a mess.
Also tried minimizing forms but "DoCmd.Minimize" minimizes the application window and there's no report in sight 😂.

The thing I want to do is, open the report in print preview mode, be able to print it, and when closing it, return to the form that called it.
Any ideas?


Thanks
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 01:04
Joined
May 7, 2009
Messages
19,245
if you a viewing the report in Tabbed document, it will always be in the back of the forms.
if you set it as pop-up it will be in front, but there is no Ribbon.

if you need the ribbon, then you need to "hide" all pop-up forms first
when the report opens and re-instate them when you close the report:
on the Report Events:
Code:
Private Sub Report_Close()
Dim i As Integer
If Forms.Count <> 0 Then
    For i = 0 To Forms.Count - 1
        Forms(i).Visible = True
    Next
End If
End Sub

Private Sub Report_Open(Cancel As Integer)
Dim i As Integer
If Forms.Count <> 0 Then
    For i = Forms.Count - 1 To 0 Step -1
        Forms(i).Visible = False
    Next
End If
End Sub
 

AlexN

Registered User.
Local time
Today, 20:04
Joined
Nov 10, 2014
Messages
302
if you a viewing the report in Tabbed document, it will always be in the back of the forms.
if you set it as pop-up it will be in front, but there is no Ribbon.

if you need the ribbon, then you need to "hide" all pop-up forms first
when the report opens and re-instate them when you close the report:
on the Report Events:
Code:
Private Sub Report_Close()
Dim i As Integer
If Forms.Count <> 0 Then
    For i = 0 To Forms.Count - 1
        Forms(i).Visible = True
    Next
End If
End Sub

Private Sub Report_Open(Cancel As Integer)
Dim i As Integer
If Forms.Count <> 0 Then
    For i = Forms.Count - 1 To 0 Step -1
        Forms(i).Visible = False
    Next
End If
End Sub
Thank you.
Just tried it. Almost working. Last form though (the one that calls the report) never comes back. Have to check why...


Forms (all 3 of them) have properties set Popup=No, Modal=No, and are opened in Dialog Mode (acDialog).

Database is set in overlapping windows mode.

Update:

There's a ButtonA in FormA that calls FormB and a ButtonB in FormB that calls the report.
Applying your suggestion after closing the report, only FormA comes back but... (wth)... ButtonA doesn't open FormB. I have to compact and repair to make it work again.
 
Last edited:

AlexN

Registered User.
Local time
Today, 20:04
Joined
Nov 10, 2014
Messages
302
Still struggling. Can't find why the report calling form doesn't re-instate.
I'm almost oriented to directly print the report without previewing it.
Meanwhile, should anyone of you kind gentlemen comes with a solution, please do post it here.
Thanks
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 18:04
Joined
Sep 12, 2006
Messages
15,658
Why do you need dialog mode for the other forms?. Why not open them in normal mode?
 

isladogs

MVP / VIP
Local time
Today, 18:04
Joined
Jan 14, 2017
Messages
18,237
Agree with the previous post. Using dialog mode should only be necessary on rare occasions.
Suggest you look at my example app on controlling the application interface.
Although manly intended for working with both form s & reports where the application interface is hidden, it should help you with your setup.
The example app shows 3 ways of managing reports
 

AlexN

Registered User.
Local time
Today, 20:04
Joined
Nov 10, 2014
Messages
302
@gemma-the-husky , @isladogs thank you both.

Fact is, I don't really know why I use these forms in dialog mode. I guess it was to avoid closing and re-opening every time. But...to avoid that, I had a hard time positioning dialog forms to cover one another :ROFLMAO:. Anyway I learned something from this.
I'll try your suggestion, changing a lot of things first, an I'll let you know how it goes.


Thanks again!
 

AlexN

Registered User.
Local time
Today, 20:04
Joined
Nov 10, 2014
Messages
302
Well, you all know that Queen's song "I'm going slightly mad"? That's what happens to me now.

I open all forms in window normal mode (without closing the previous one). I open the report in window normal mode to keep its ribbon in sight. Guess what. When I close the report, all forms are closing too. I stay staring at an empty application window.
Don't know anymore. I'll give it one more last chance, that's to open the report in dialog mode (in order to keep forms open behind it) and force call the report ribbon to appear.
Should this one fail too, I'm giving up. I'll go to directly printing the report without previewing it.

Thank you all.
 

Users who are viewing this thread

Top Bottom