command code for close button on Access Report in VB?

stephenlecompte
08-10-2003, 06:45 PM
Using the following code - I've got Access pulling up a report in Visual Basic! Thanks to everyone's help!

Private Sub Form_Load()

Dim appAccess As Access.Application
Set appAccess = New Access.Application
appAccess.OpenCurrentDatabase "c:\Documents and Settings\Stephen LeCompte\My Documents\disp-1.mdb"
appAccess.DoCmd.Maximize
appAccess.DoCmd.OpenReport "DATE FORWARD REPORT", acPreview
appAccess.Visible = True
End Sub

What I have done is with Form1 is have it minimize when ran and that immediately shifts focus to the Access report. Now when the Close button (on the Access report) is pressed - of course the report goes away. When I want to end the program - I bring up Form1 and press the Command1 button that allows me to QUIT the program

Private Sub Command1_Click()
Set appAccess = Nothing
Unload Me
End Sub

My problem is when the report goes away - I want my Form1 to maximize itself and bring the focus on to that object.

In order to do this, I need Visual basic to recognize the close button when it is fired - what is the code to do this? And even if I get the code to do this - what is the procedure I need to put it under? Is there a much better way for me to do the above besides recognizing the close button pressed? Thanks for the great help and learning. It is much appreciated.

Sincerely,


Stephen

trental
08-11-2003, 03:10 AM
sounds like your venturing into the API.

Can you leave your vb form maximised but open tthe database vb modal?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum