Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

POP-UP REPORTS????

Status
Not open for further replies.

Danielle17

Technical User
Apr 17, 2001
102
0
0
US
I have 4 forms--all of which are pop-up forms so that there are no toolbars present. On one of those forms I have a command button that is supposed to show the user a report. The report works just fine but it pops up behind all of the forms. Is there a way that I can have the report pop-up in front of all of the forms? I checked the properties on the report but there isn't one about being a pop up. The command button that pops up the report has some code so I thought maybe I could put something in there...but I don't know a lot of code. Please help! :)
 
Annoying, ain't it:

Someone at the Compuserve Access forum showed me this:

Private Sub Command49_Click()
Forms![frmLocation].Visible = False
DoCmd.OpenReport "rptSite", acViewPreview
While IsReportLoaded("rptSite")
DoEvents
Wend
Forms![frmLocation].Visible = True
End Sub

This function hides to popup form whilst the report is loaded. To work, it you will also need to create a module like this...

Option Compare Database 'Use database order for string comparisons
Option Explicit
Function IsFormLoaded(strName As String)
IsFormLoaded = (SysCmd(SYSCMD_GETOBJECTSTATE, A_FORM, strName) > 0)
End Function
Function IsReportLoaded(strName As String)
IsReportLoaded = (SysCmd(SYSCMD_GETOBJECTSTATE, A_REPORT, strName) > 0)
End Function

Good luck...

 
Thanks for the suggestion...I'm going to try it and see if I can get it to work...:)
 
Okay I used it and it worked.....BUT I have the main form, and 2 other forms that are still in front of it so I put those in the code as well...I'm not sure if it's correctly typed in....

Private Sub Command59_Click()
Dim stDocName1 As String
Dim strCrit1 As String
'Dim stDocName2 As [Form_Main Menu]
Forms![Main Menu].Visible = False
Forms![Menu].Visible = False
Forms![Find Job].Visible = False
Forms![Find Archive Job].Visible = False

'stDocName2 = "Main Menu"
stDocName1 = "zJobTable1"
strCrit1 = "#" & cldMonth.Value & "# Between zJobTable.[Start Date] AND zJobTable.[End Date]"

'DoCmd.Minimize stDocName2
DoCmd.OpenReport stDocName1, acViewPreview, , strCrit1
While IsReportLoaded(stDocName1)
DoEvents
Wend
Forms![Main Menu].Visible = True
Forms![Menu].Visible = True
Forms![Find Job].Visible = True
Forms![Find Archive Job].Visible = True

End Sub
Function IsFormLoaded(strName As String)
IsFormLoaded = (SysCmd(acSysCmdGetObjectState, A_FORM, strName) > 0)
End Function
Function IsReportLoaded(strName As String)
IsReportLoaded = (SysCmd(acSysCmdGetObjectState, A_REPORT, strName) > 0)
End Function
 
oops....forgot to say that it didn't work! s-)
 
I am a little unclear just how this dosen't work. It should, even with your mods. What is the error?

The biggest issue you might get is the order in which the Forms "reappear". If any of the forms are modal this may give you a problem. Try making the forms not modal and give it a whirl.

Alternatively, you can use the method (hiding the previous form) when you open each of the 4 forms eg:

Forms![Form1].Visible = False

DoCmd.OpenForms "Form2"

While IsFormLoaded("Form2")
DoEvents
Wend
Forms![Form1].Visible = True

This will work! (He says confidently)
 
I hope you're still there....

I checked to see if the forms had the modal property set to yes...they all were set to No. So then I moved on to using the new suggestion you gave. I'm not sure exactly how to set it up. I need to keep the code for the report so where do I put this new bit of code?

The error that I keep getting is that Access can't find the forms that I have typed in. I thought maybe I had typos but all of them are spelled correctly and I know they exist in that database. Also on the error message it makes a note about them not being opened. What exactly does that mean? I thought they were already open???

Please bestow some knowledge on me!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top