-
Hello All,
I was wondering if someone can help me with this problem I've been having for quite a while. Does anyone know how to maximized an Access application window and if possible to be controlled by the VB application. How do
you do that?
Marci Sarwan ([email protected])
-
hm..
In Access create a macro and put command "Maximize" close it and name it autoexec.
Now everytime you load that databas it run autoexec automatic and maximize the window.
-
I don't have an sample code with me (I am at work) but to Maximize an form or what not in code in Access its DoCmd.Maximize (I think). Also to run Access from inside a VB Program you first have to reference the Access object (like 8.0 or something) and then create the object in your program:
Code:
Dim AccVB as New Application
Set AccVB=Application.Access
Or round about there (I'm just going by memory)
-
Hi Edneeis,
I tried your suggestion and can't seem to get it to work. If it's not too much trouble would you mind putting a small simple program to solve my solution. I urgently need this and have been working on this without any luck. Thanks a million!
Marci Sarwan ([email protected])
-
Here is code for printing a report in Access and Word from within VB
Note you must first reference 'Microsoft Access 8.0 Object Library' and 'Microsoft Word 9.0 Object'
The version may be different depending on what version of Access and Word you have (You must have these programs already installed for this to work)
Code:
Dim appAccess As Access.Application
Set appAccess = New Access.Application'these set up the object
appAccess.OpenCurrentDatabase "I:\Payroll\Payroll.mdb"'put the database path here
appAccess.Run "SetParam", CDate(txtPPE.Text)'this runs a macro in access named setparam
appAccess.DoCmd.OpenReport "Payroll New Full", acViewNormal'this actually prints the report
appAccess.Quit'quits access
Set appAccess=Nothing'frees up memory
Here is for Word
Code:
Dim appWord As Word.Application
Set appWord = New Word.Application'these set up the object
appWord.Documents.Open "I:\Payroll\Payroll Forms Access.doc", , , , , , , , , , , True'put document path here
appWord.Run "Payroll", CDate(txtPPE.Text)'runs a macro in word
appWord.ActiveDocument.Close'closes
appWord.Quit'quits word
set appWord=Nothing'frees memory
Of course this is just printing but once you open the db or doc you can use any VBA commands like to maximize a form in Access add this after the OpenForm (where my openReport is) line:
Code:
appAccess.DoCmd.Maximize
Does that help, if it is confusing just email me
Note: Things to watch for with subclassing (that what this is called) Word and printing if you try to quit while it is still sending to the printer then it prompts the user about aborting the print.
-
Simply Way
the VBA code for maximize an Access- application is
DoCmd.Maximize