ANOTHER help example doesn't work 
Author Message
 ANOTHER help example doesn't work

Here's code directly from the VBA help that doesn't work, even if I define
strDB as string, which it doesn't tell you to do.  The appAccess object gets
opened, but the form won't open.  Or, if the form is opened I can't see it.
What good does it do me to have the form open if I can't see it?  I want to
have my users opening and using forms in one database from another database.
I really hate trying anything new in Access.

' Include following in Declarations section of module.
Dim appAccess As Access.Application

Sub DisplayForm()
    ' Initialize string to database path.
    Const strConPathToSamples = "C:\Program " _
        & "Files\Microsoft Office\Office\Samples\Northwind.mdb"

    strDB = strConPathToSamples & "Northwind.mdb"
    ' Create new instance of Microsoft Access.
    Set appAccess = _
        CreateObject("Access.Application")
    ' Open database in Microsoft Access window.
    appAccess.OpenCurrentDatabase strConPathToSamples
    ' Open Orders form.
    appAccess.DoCmd.OpenForm "Orders"
End Sub

TIA, Caro :-(



Tue, 28 Jan 2003 03:00:00 GMT  
 ANOTHER help example doesn't work

hi Carolyn,
I just tested the code.
Used as is, Northwinds opened , but was minimized.
I then added this line at the very end:
appAccess.Visible = True
It worked fine.

hth
Dan

Quote:

> Here's code directly from the VBA help that doesn't work, even if I define
> strDB as string, which it doesn't tell you to do.  The appAccess object gets
> opened, but the form won't open.  Or, if the form is opened I can't see it.
> What good does it do me to have the form open if I can't see it?  I want to
> have my users opening and using forms in one database from another database.
> I really hate trying anything new in Access.

> ' Include following in Declarations section of module.
> Dim appAccess As Access.Application

> Sub DisplayForm()
>     ' Initialize string to database path.
>     Const strConPathToSamples = "C:\Program " _
>         & "Files\Microsoft Office\Office\Samples\Northwind.mdb"

>     strDB = strConPathToSamples & "Northwind.mdb"
>     ' Create new instance of Microsoft Access.
>     Set appAccess = _
>         CreateObject("Access.Application")
>     ' Open database in Microsoft Access window.
>     appAccess.OpenCurrentDatabase strConPathToSamples
>     ' Open Orders form.
>     appAccess.DoCmd.OpenForm "Orders"
> End Sub

> TIA, Caro :-(



Tue, 28 Jan 2003 03:00:00 GMT  
 ANOTHER help example doesn't work
(AC97) Replacing your last line with this should force the form to the
front:
    appAccess.DoCmd.OpenForm "Orders", , , , , acDialog

Also note that the Help entry specifically says that OpenCurrentDatabase is
for the opening of a database in an Access window when you're using
automation **from another application** (like Excel).  If you're using it
from within Access, any unexpected behavior *might* not necessarily be the
fault of the Help file, which doesn't address that possibility.  (I don't
know if there's a problem there one way or the other: I'm just voicing a
note of caution.)

HTH,
George Nicholson


Quote:
> Here's code directly from the VBA help that doesn't work, even if I define
> strDB as string, which it doesn't tell you to do.  The appAccess object
gets
> opened, but the form won't open.  Or, if the form is opened I can't see
it.
> What good does it do me to have the form open if I can't see it?  I want
to
> have my users opening and using forms in one database from another
database.
> I really hate trying anything new in Access.

> ' Include following in Declarations section of module.
> Dim appAccess As Access.Application

> Sub DisplayForm()
>     ' Initialize string to database path.
>     Const strConPathToSamples = "C:\Program " _
>         & "Files\Microsoft Office\Office\Samples\Northwind.mdb"

>     strDB = strConPathToSamples & "Northwind.mdb"
>     ' Create new instance of Microsoft Access.
>     Set appAccess = _
>         CreateObject("Access.Application")
>     ' Open database in Microsoft Access window.
>     appAccess.OpenCurrentDatabase strConPathToSamples
>     ' Open Orders form.
>     appAccess.DoCmd.OpenForm "Orders"
> End Sub

> TIA, Caro :-(



Tue, 28 Jan 2003 03:00:00 GMT  
 ANOTHER help example doesn't work
Hi, Dan

Thanks for your help.  Yes, that worked.  Now all I have to do is figure out
how to change it back to invisible after they've closed the form.  Since
Access doesn't have a way to wait for the form, I guess I'll have to create
my own with a DoEvents loop.

How typical that they would leave that little statement out of the example.

Caro ;-)


Quote:
> hi Carolyn,
> I just tested the code.
> Used as is, Northwinds opened , but was minimized.
> I then added this line at the very end:
> appAccess.Visible = True
> It worked fine.

> hth
> Dan


> > Here's code directly from the VBA help that doesn't work, even if I
define
> > strDB as string, which it doesn't tell you to do.  The appAccess object
gets
> > opened, but the form won't open.  Or, if the form is opened I can't see
it.
> > What good does it do me to have the form open if I can't see it?  I want
to
> > have my users opening and using forms in one database from another
database.
> > I really hate trying anything new in Access.

> > ' Include following in Declarations section of module.
> > Dim appAccess As Access.Application

> > Sub DisplayForm()
> >     ' Initialize string to database path.
> >     Const strConPathToSamples = "C:\Program " _
> >         & "Files\Microsoft Office\Office\Samples\Northwind.mdb"

> >     strDB = strConPathToSamples & "Northwind.mdb"
> >     ' Create new instance of Microsoft Access.
> >     Set appAccess = _
> >         CreateObject("Access.Application")
> >     ' Open database in Microsoft Access window.
> >     appAccess.OpenCurrentDatabase strConPathToSamples
> >     ' Open Orders form.
> >     appAccess.DoCmd.OpenForm "Orders"
> > End Sub

> > TIA, Caro :-(



Tue, 28 Jan 2003 03:00:00 GMT  
 ANOTHER help example doesn't work
Something I've had a real problem with using automation is the fact that the
PID (check your task manager) is still there after the document is closed.
If you want it to go invisible after the form is clicked you can just use

    with app
        .visible = false
    end with

but it will still be{*filter*} around in the memory, when you go to close out
the application though, make sure it runs an app.quit

-- jb


Quote:
> Here's code directly from the VBA help that doesn't work, even if I define
> strDB as string, which it doesn't tell you to do.  The appAccess object
gets
> opened, but the form won't open.  Or, if the form is opened I can't see
it.
> What good does it do me to have the form open if I can't see it?  I want
to
> have my users opening and using forms in one database from another
database.
> I really hate trying anything new in Access.

> ' Include following in Declarations section of module.
> Dim appAccess As Access.Application

> Sub DisplayForm()
>     ' Initialize string to database path.
>     Const strConPathToSamples = "C:\Program " _
>         & "Files\Microsoft Office\Office\Samples\Northwind.mdb"

>     strDB = strConPathToSamples & "Northwind.mdb"
>     ' Create new instance of Microsoft Access.
>     Set appAccess = _
>         CreateObject("Access.Application")
>     ' Open database in Microsoft Access window.
>     appAccess.OpenCurrentDatabase strConPathToSamples
>     ' Open Orders form.
>     appAccess.DoCmd.OpenForm "Orders"
> End Sub

> TIA, Caro :-(



Tue, 28 Jan 2003 03:00:00 GMT  
 ANOTHER help example doesn't work
Hi, James

What I want to happen is for the second app to go invisible when its form is
closed.  I'm having a hard time figuring out how to know in the first app
whether the form in the second app is closed or not.

I had already planned to close the second app when the main form in my first
app is closed.

Caro :-(


Quote:
> Something I've had a real problem with using automation is the fact that
the
> PID (check your task manager) is still there after the document is closed.
> If you want it to go invisible after the form is clicked you can just use

>     with app
>         .visible = false
>     end with

> but it will still be{*filter*} around in the memory, when you go to close
out
> the application though, make sure it runs an app.quit

> -- jb



> > Here's code directly from the VBA help that doesn't work, even if I
define
> > strDB as string, which it doesn't tell you to do.  The appAccess object
> gets
> > opened, but the form won't open.  Or, if the form is opened I can't see
> it.
> > What good does it do me to have the form open if I can't see it?  I want
> to
> > have my users opening and using forms in one database from another
> database.
> > I really hate trying anything new in Access.

> > ' Include following in Declarations section of module.
> > Dim appAccess As Access.Application

> > Sub DisplayForm()
> >     ' Initialize string to database path.
> >     Const strConPathToSamples = "C:\Program " _
> >         & "Files\Microsoft Office\Office\Samples\Northwind.mdb"

> >     strDB = strConPathToSamples & "Northwind.mdb"
> >     ' Create new instance of Microsoft Access.
> >     Set appAccess = _
> >         CreateObject("Access.Application")
> >     ' Open database in Microsoft Access window.
> >     appAccess.OpenCurrentDatabase strConPathToSamples
> >     ' Open Orders form.
> >     appAccess.DoCmd.OpenForm "Orders"
> > End Sub

> > TIA, Caro :-(



Tue, 28 Jan 2003 03:00:00 GMT  
 ANOTHER help example doesn't work
Hi Carolyn,
Simply put this line in the Close
event of the form (of the second app)
Me.Application.Visible = False
hth
Dan
Quote:

> Hi, James

> What I want to happen is for the second app to go invisible when its form is
> closed.  I'm having a hard time figuring out how to know in the first app
> whether the form in the second app is closed or not.

> I had already planned to close the second app when the main form in my first
> app is closed.

> Caro :-(



> > Something I've had a real problem with using automation is the fact that
> the
> > PID (check your task manager) is still there after the document is closed.
> > If you want it to go invisible after the form is clicked you can just use

> >     with app
> >         .visible = false
> >     end with

> > but it will still be{*filter*} around in the memory, when you go to close
> out
> > the application though, make sure it runs an app.quit

> > -- jb



> > > Here's code directly from the VBA help that doesn't work, even if I
> define
> > > strDB as string, which it doesn't tell you to do.  The appAccess object
> > gets
> > > opened, but the form won't open.  Or, if the form is opened I can't see
> > it.
> > > What good does it do me to have the form open if I can't see it?  I want
> > to
> > > have my users opening and using forms in one database from another
> > database.
> > > I really hate trying anything new in Access.

> > > ' Include following in Declarations section of module.
> > > Dim appAccess As Access.Application

> > > Sub DisplayForm()
> > >     ' Initialize string to database path.
> > >     Const strConPathToSamples = "C:\Program " _
> > >         & "Files\Microsoft Office\Office\Samples\Northwind.mdb"

> > >     strDB = strConPathToSamples & "Northwind.mdb"
> > >     ' Create new instance of Microsoft Access.
> > >     Set appAccess = _
> > >         CreateObject("Access.Application")
> > >     ' Open database in Microsoft Access window.
> > >     appAccess.OpenCurrentDatabase strConPathToSamples
> > >     ' Open Orders form.
> > >     appAccess.DoCmd.OpenForm "Orders"
> > > End Sub

> > > TIA, Caro :-(



Tue, 28 Jan 2003 03:00:00 GMT  
 ANOTHER help example doesn't work
Hi, Dan

You're the best.  Thanks so much.  Pardon me if I ask one more question:  Is
there a way to condition setting the application's visible property to false
based on whether the calling application is open or not?

Caro ;-)


Quote:
> Hi Carolyn,
> Simply put this line in the Close
> event of the form (of the second app)
> Me.Application.Visible = False
> hth
> Dan


> > Hi, James

> > What I want to happen is for the second app to go invisible when its
form is
> > closed.  I'm having a hard time figuring out how to know in the first
app
> > whether the form in the second app is closed or not.

> > I had already planned to close the second app when the main form in my
first
> > app is closed.

> > Caro :-(



> > > Something I've had a real problem with using automation is the fact
that
> > the
> > > PID (check your task manager) is still there after the document is
closed.
> > > If you want it to go invisible after the form is clicked you can just
use

> > >     with app
> > >         .visible = false
> > >     end with

> > > but it will still be{*filter*} around in the memory, when you go to
close
> > out
> > > the application though, make sure it runs an app.quit

> > > -- jb



> > > > Here's code directly from the VBA help that doesn't work, even if I
> > define
> > > > strDB as string, which it doesn't tell you to do.  The appAccess
object
> > > gets
> > > > opened, but the form won't open.  Or, if the form is opened I can't
see
> > > it.
> > > > What good does it do me to have the form open if I can't see it?  I
want
> > > to
> > > > have my users opening and using forms in one database from another
> > > database.
> > > > I really hate trying anything new in Access.

> > > > ' Include following in Declarations section of module.
> > > > Dim appAccess As Access.Application

> > > > Sub DisplayForm()
> > > >     ' Initialize string to database path.
> > > >     Const strConPathToSamples = "C:\Program " _
> > > >         & "Files\Microsoft Office\Office\Samples\Northwind.mdb"

> > > >     strDB = strConPathToSamples & "Northwind.mdb"
> > > >     ' Create new instance of Microsoft Access.
> > > >     Set appAccess = _
> > > >         CreateObject("Access.Application")
> > > >     ' Open database in Microsoft Access window.
> > > >     appAccess.OpenCurrentDatabase strConPathToSamples
> > > >     ' Open Orders form.
> > > >     appAccess.DoCmd.OpenForm "Orders"
> > > > End Sub

> > > > TIA, Caro :-(



Wed, 29 Jan 2003 03:00:00 GMT  
 ANOTHER help example doesn't work
Just realized--I can use form open arguments.

Caro ;-)


Quote:
> Hi, Dan

> You're the best.  Thanks so much.  Pardon me if I ask one more question:
Is
> there a way to condition setting the application's visible property to
false
> based on whether the calling application is open or not?

> Caro ;-)



> > Hi Carolyn,
> > Simply put this line in the Close
> > event of the form (of the second app)
> > Me.Application.Visible = False
> > hth
> > Dan


> > > Hi, James

> > > What I want to happen is for the second app to go invisible when its
> form is
> > > closed.  I'm having a hard time figuring out how to know in the first
> app
> > > whether the form in the second app is closed or not.

> > > I had already planned to close the second app when the main form in my
> first
> > > app is closed.

> > > Caro :-(



> > > > Something I've had a real problem with using automation is the fact
> that
> > > the
> > > > PID (check your task manager) is still there after the document is
> closed.
> > > > If you want it to go invisible after the form is clicked you can
just
> use

> > > >     with app
> > > >         .visible = false
> > > >     end with

> > > > but it will still be{*filter*} around in the memory, when you go to
> close
> > > out
> > > > the application though, make sure it runs an app.quit

> > > > -- jb



> > > > > Here's code directly from the VBA help that doesn't work, even if
I
> > > define
> > > > > strDB as string, which it doesn't tell you to do.  The appAccess
> object
> > > > gets
> > > > > opened, but the form won't open.  Or, if the form is opened I
can't
> see
> > > > it.
> > > > > What good does it do me to have the form open if I can't see it?
I
> want
> > > > to
> > > > > have my users opening and using forms in one database from another
> > > > database.
> > > > > I really hate trying anything new in Access.

> > > > > ' Include following in Declarations section of module.
> > > > > Dim appAccess As Access.Application

> > > > > Sub DisplayForm()
> > > > >     ' Initialize string to database path.
> > > > >     Const strConPathToSamples = "C:\Program " _
> > > > >         & "Files\Microsoft Office\Office\Samples\Northwind.mdb"

> > > > >     strDB = strConPathToSamples & "Northwind.mdb"
> > > > >     ' Create new instance of Microsoft Access.
> > > > >     Set appAccess = _
> > > > >         CreateObject("Access.Application")
> > > > >     ' Open database in Microsoft Access window.
> > > > >     appAccess.OpenCurrentDatabase strConPathToSamples
> > > > >     ' Open Orders form.
> > > > >     appAccess.DoCmd.OpenForm "Orders"
> > > > > End Sub

> > > > > TIA, Caro :-(



Wed, 29 Jan 2003 03:00:00 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. Listing subdirs - Dir$ Help Example doesn't work !

2. Microsoft example doesn't work

3. Process.Start - example doesn't work

4. Microsoft example doesn't work...

5. dotnetfx.exe bootstrapper example setup.exe doesn't work

6. DragIcon Property Problem /VB Example Doesn't work

7. Why doesn't MSDN ListView examples work?

8. fRefreshLinks Doesn't work if path doesn't exist

9. VB5 vs VB4 - example program in help doesn't run

10. Mouse Wheel doesn't work in Visual Studio's IDE enviornment...HELP

11. Can't get Microsoft DAO example to work, please help

12. Windows Service Calling VB6 dll doesn't work but works with VB6

 

 
Powered by phpBB® Forum Software