RE: Opening Access database



Hi Matt,

Here's a quick solution (I've yet to find one by using the created object
itself), although I'm not very keen on this method.

oApp.Visible = True
SendKeys "% x"

I know that sometimes quotes etc are replaced in these community
communications, so that is: SendKeys doublequote percent space x doublequote

Anyway, this should work in general, I have tested and it worked for me. It
simply sends ALT space then X to maximise the window. Drawbacks are that you
can't use it when stepping through the code as the VBA editor will remain on
top and you'll be sending the keystrokes to it and not Access. Also, if some
greedy application steals focus (unlikely if you write it straight after
Visible = True), then that app will receive the keystrokes. To test in the
debug environment simply place a breakpoint after the sendkeys and run the
code.

There are other methods, search for Shell Function in the VBA help, which
allow you to run an app from the shell and at the same time you can set the
opening window state. You will get the Prog ID returned, but I don't know if
you'll have enough control over the app as you might require. Also, using the
CreateObject method, the app is killed when the object is killed, but using
the Shell method then you will have to write code specifically to kill the
app when you're done.

If I find a method using the object directly then I'll post again. Hope this
helps a bit.

Sean.

"Launchnet" wrote:

The following code works fine, except that the database opens in a small
window. I want it to always open full screen. Can someone take a look and
advise me on what code to add ?

Thanks
Matt@Launchnet


Sub NewAccessWithDocument()

'ActiveWorkbook.FollowHyperlink Address:="C:\_Matts Data\0_avp\
avpdatabasesample.mdb"


Dim LPath As String
Dim LCategoryID As Long

'Path to Access database
LPath = "C:\_Matts Data\0_avp\avpdatabasesample.mdb"

'Open Access and make visible
Set oApp = CreateObject("Access.Application")
oApp.Visible = True

'Open Access database as defined by LPath variable
oApp.OpenCurrentDatabase LPath

End Sub

--
Please take a look at www.openoursite.com Click on: "Keywords" and then
Click on "Matt's Story" and if you are a man, you should be very happy that
you read my story. God Bless for everyones help.

Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.aspx/excel-programming/200707/1


.



Relevant Pages

  • Help - Problem Getting DataAdapter to update
    ... I seem to be having a problem with a DataAdapter against an Access database. ... My app deletes 3 records runs a da.updatewhere dt is a data.Datatable. ... passed an Invoice number to select, system just works out what the Invoice ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Backup Question
    ... "How in code could I have an Access Database make a copy of itself to ... the app ... > compact itself, but you can lauch another app that will do the job. ... > separate file you can copy or compact the back end file from code in the ...
    (microsoft.public.access.gettingstarted)
  • RE: Shell can open an application, can it close an app too?
    ... Shell cannot close the app. ... simplest way is probably to use SendKeys to send the proper command to close ... But SendKeys can be tricky since you ...
    (microsoft.public.excel.programming)
  • Re: Blocking User Input
    ... CSV file format. ... SENDKEYS was a suggestion. ... It doesn't care what that app is and there's no way to send ...
    (microsoft.public.vb.winapi)
  • Re: Launch app (Shell)
    ... When you shell out to an app, there are API functions that can ... It is a cleaner option than SendKeys. ... Some applications, e.g. most Office applications, are Automation ... The full version of Acrobat has an Automation interface; ...
    (microsoft.public.access.modulesdaovba)