Opening a report using a Button

Beany

Registered User.
Local time
Today, 09:39
Joined
Nov 12, 2006
Messages
155
Hi,

just a simple one...........

ive got a button to open a report.............

but the report opens behind the button window and to view the report fully i must close down the button window.......... how do i open the report above the button window??????????????????????????????

the code im using:

PHP:
Private Sub Command11_Click()
On Error GoTo Err_Command11_Click


   ''OPENS THE report IN A NEW POPUP WINDOW
DoCmd.OpenForm "reportform", acNormal, , , , acDialog

Exit_Command11_Click:
    Exit Sub

Err_Command11_Click:
    MsgBox Err.Description
    Resume Exit_Command11_Click
    
End Sub
 
I have similar command buttons but I do it the easy way since I am not a programmer. In design view place a command button right click to select Build Event and then right select Macro. Under the Action heading you select what you want the macro to do. In this case Open and Close-two different action lines.
 
Hi,

KATCanDo, ive tried it that way too, but it still opens the report behind my button window.......... y is that???????????????

any1?
 
To clarify . . .?

When you say button window do you mean button on a form? And if so, can you close this form with the second action statement in the macro? Before I told the form with the buttons on it to close at least the form would minimize when I opened the report so I have not had your exact problem. Sorry if this is no help.
 
It sounds like your form was opened in dialog mode (via the DoCmd.OpenForm code), or it is set as modal or popup, which will keep it on top of anything you open and won't let you do anything with anything else unless it is closed.

To solve that, don't open the form as dialog or, if you didn't do that, change the modal or popup to NO.
 
the popup and modal are NO......

what shall i change the dialog to ?????????
 
PHP:
Private Sub Command11_Click() 
On Error GoTo Err_Command11_Click 


   ''OPENS THE report IN A NEW POPUP WINDOW 
DoCmd.OpenForm "reportform", acWindowNormal, , , , acDialog 

Exit_Command11_Click: 
    Exit Sub 

Err_Command11_Click: 
    MsgBox Err.Description 
    Resume Exit_Command11_Click 
     
End Sub

sorry i think ive got you confused Bob, im trying to open a 'report' (not a form) in a new window(coming above the button window screen) and im using the above code........

im doing sumat obviously wrong???? what is it?
 
No, I wasn't thinking that. You misunderstood me. What I said was that the form that you are opening the report from was probably opened incorrectly and so when you try to open that REPORT from the FORM the form still has the focus because of the way it was originally opened.

What is the code that originally opens the FORM (from which you are trying to open your REPORT)?
 
sorry for misunderstanding you Bob,

the code that opens the form (from which i want to open the report from) is:

PHP:
Private Sub Command11_Click()
On Error GoTo Err_Command11_Click


   ''OPENS THE FORM IN A NEW POPUP WINDOW
DoCmd.OpenForm "reportform", acNormal, , , , acDialog

Exit_Command11_Click:
    Exit Sub

Err_Command11_Click:
    MsgBox Err.Description
    Resume Exit_Command11_Click
    
End Sub
 
Last edited:
any1????? my database is annoyin me!!:mad:
 
Use this bit of the open form method

DoCmd.OpenForm "reportform", acNormal

mick
 
Yes, Mick is correct and you were opening it exactly as I had suspected. By using the acDialog part on there, it tells Access to open that form as a dialog, which means that the form stays on top of everything and you can't do anything with any other object until that form gets closed. If you use the code Mick supplied, you shouldn't have a problem anymore.
 
i used the followig code:

PHP:
DoCmd.OpenForm "reportform", acNormal, , , , acDialog

because i want the form window (from which i want to open the report from) comes above every other window???

Using Mic codes:

PHP:
DoCmd.OpenForm "reportform", acNormal

corrects everything but doesnt open as a window that comes above everything.........

what can i do? so basically anything i select(report or form) i would like it to come above everything???!!!!:(
 
To Be honest Beany Your heading for some very serious navigation problems if you try to open everything in dialog, Popup.

But you may find using Popup in the forms propertys sheet rather than dialog may give you a bit of scope.
 
ive changed the forms popup to YES.... and it works but.............

after this when i try to open a report(from the popup form) it hides behind the popup form.......

i have to close down the popup form to view the report!!!

my database is crazy ..........................


arghhhhhh:mad:
 
Do NOT use the form as POPUP! It is the same thing as DIALOG but said differently in the properties. Just set it to open normally.
 
im not getting nowhere (i still appreciate what ur help)..........


what shal i do?
 
Set the form's properties to be POPUP NO MODAL NO and open it like Dreamweaver had posted. Be sure that ALL forms that you have opened (if more than one are opened) are done the same way.
 

Users who are viewing this thread

Back
Top Bottom