Pop Up Form Problem

Radar

New member
Local time
Today, 16:24
Joined
May 3, 2002
Messages
7
I have a form (Data Input Form)on which I placed a Command Button to open a Pop Up Modal box, which contains more command buttons to "Print Preview" various reports.

Just recently, when I click the command button for the report I want (on the pop-up form), the pop up box closes (as it should), but the print preview screen opens "behind" the Data InputForm (I must minimize the Data Input Form and then maximize the print preview form that I selected.)

Once I have done this minimize/maximize routine once, the Print Preview comes up as it should when I use the command buttons. However, when I close the Data Input Form and open it again later, I go through it all over again.

I have several other forms with the same type of command buttons, and they operate properly.

Anyone ever hear of this one before? I am using Office 97.
 
if I read your problem correctly...

Use:

Docmd.Minimise

at the start of the report opening procedure to minimise the data form so you can see the report.

Use:

Docmd.Maximise

in the reports OnOpen event to make it take up the whole window.

Use:

Forms("DataFormName").SetFocus
Docmd.Restore

in the Reports OnClose event to reset the form to its normal size.
 
Fornatian -

Thank you for you interest and help. But before I go in and start messing around with my "fragile" database, I'd like to explain my problem a bit better.

1. I initially did not have this problem when I created all the command buttons on the pop up form. It just recently began to behave this way.

2. I understand your recommendation to mean that I should use solution on "each" of the command buttons that bring up the reports. I have 15 command buttons!

3. I used macros to create each command button. I am not that familiar with VBA, so I don't know how exactly to do what you recommend. (I used macros for this type of command button because it's the only way I know how to bring up a report for the "current" record, not all the records, as the command button wizard does.)

Does this make any better sense to you?

If code works better, could you explain the command to go a print preview for the current record.

Thanks so much.
 
You can use the Command Button wizard to build a button that will open your report with code instead of a Macro. Open the Toolbox, make sure the Lightning Bolt is checked at the top, select Command Button, then when it come sup, Report Operations: Preview Report. Follow the rest of the steps.

The problem with this is that it doesn't give you the option to select just the current record. To solve this, click on your command button in Design View and go to Build Event. You'll see the button_Click event code come up. One of the lines will look very much like this:
Code:
DoCmd.OpenReport stDocName, acPreview

go to the end of this line and add
Code:
,,"[PKField] = " & [PKControlOnForm]
so it will look like this:
Code:
DoCmd.OpenReport stDocName, acPreview,,[PKField] = " & [PKControlOnForm]

I'm assuming you know how to make a report display only the current record with a macro (the WHERE clause). The syntax is very similar with code, except you have to add quotes if it is a text field you're matching on.
 
IT WORKS! Thanks so much for your help. This discussion group is far more useful than any other I've visited. You guys are great.
 

Users who are viewing this thread

Back
Top Bottom