|
 |
access thread: opening a form in another database
Message #1 by "Howard Stone" <ququmber@h...> on Thu, 6 Jun 2002 15:54:38
|
|
If I have a form, frmA in database A and I am in datadase B, what is the
best way to open frmA from database B ?
Thanks
Message #2 by "John Ruff" <papparuff@c...> on Thu, 6 Jun 2002 09:42:42 -0700
|
|
Try this (from MSDN),
Dim appAccess As Access.Application
Dim strDB As String
' Initialize string to database path.
Const strConPathToSamples = "C:\Program Files\Office
2K\Office\Samples"
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"
John Ruff - The Eternal Optimist :-)
Always Looking for a Contract Opportunity
xxx.xxx.xxxx
9306 Farwest Dr SW
Lakewood, WA 98498
-----Original Message-----
From: Howard Stone [mailto:ququmber@h...]
Sent: Thursday, June 06, 2002 3:55 PM
To: Access
Subject: [access] opening a form in another database
If I have a form, frmA in database A and I am in datadase B, what is the
best way to open frmA from database B ?
Thanks
Message #3 by "Howard Stone" <ququmber@h...> on Fri, 7 Jun 2002 16:50:51
|
|
Thanks John:
The db is located on a network and all the db are on the F drive.
After creating a command button and copying the procedure exactly as
written I got an error message "The command or action "OpenForm" is'nt
available now". Error message 2046.
This is what I have:
Dim strDB As String
Const strPathToForm = "F:\Customer\Service\Source"
strDB = strPathToForm & "MainDB.mdb"
Dim appAccess As New Access.Application
'Create new instance of Access
Set appAccess = CreateObject("Access.Application")
appAccess.DoCmd.OpenForm "frmMainData"
Any furthers insight?
Thanks
> Try this (from MSDN),
Dim appAccess As Access.Application
Dim strDB As String
' Initialize string to database path.
Const strConPathToSamples = "C:\Program Files\Office
2K\Office\Samples"
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"
John Ruff - The Eternal Optimist :-)
Always Looking for a Contract Opportunity
xxx.xxx.xxxx
9306 Farwest Dr SW
Lakewood, WA 98498
-----Original Message-----
From: Howard Stone [mailto:ququmber@h...]
Sent: Thursday, June 06, 2002 3:55 PM
To: Access
Subject: [access] opening a form in another database
If I have a form, frmA in database A and I am in datadase B, what is the
best way to open frmA from database B ?
Thanks
Message #4 by braxis@b... on Fri, 7 Jun 2002 17:02:36 +0100 (BST)
|
|
Howard
You seem to be missing a '\' between your path and database. Try changing your constant declaration to:
Const strPathToForm = "F:\Customer\Service\Source\"
Brian
> from: Howard Stone <ququmber@h...>
> date: Fri, 07 Jun 2002 17:50:51
> to: access@p...
> subject: Re: [access] RE: opening a form in another database
>
> Thanks John:
>
> The db is located on a network and all the db are on the F drive.
> After creating a command button and copying the procedure exactly as
> written I got an error message "The command or action "OpenForm" is'nt
> available now". Error message 2046.
>
> This is what I have:
>
>
>
>
> Dim strDB As String
> Const strPathToForm = "F:\Customer\Service\Source"
> strDB = strPathToForm & "MainDB.mdb"
> Dim appAccess As New Access.Application
> 'Create new instance of Access
> Set appAccess = CreateObject("Access.Application")
> appAccess.DoCmd.OpenForm "frmMainData"
>
> Any furthers insight?
>
> Thanks
>
>
> > Try this (from MSDN),
>
> Dim appAccess As Access.Application
> Dim strDB As String
>
> ' Initialize string to database path.
> Const strConPathToSamples = "C:\Program Files\Office
> 2K\Office\Samples"
>
> 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"
>
> John Ruff - The Eternal Optimist :-)
> Always Looking for a Contract Opportunity
>
> xxx.xxx.xxxx
> 9306 Farwest Dr SW
> Lakewood, WA 98498
>
>
>
> -----Original Message-----
> From: Howard Stone [mailto:ququmber@h...]
> Sent: Thursday, June 06, 2002 3:55 PM
> To: Access
> Subject: [access] opening a form in another database
>
>
> If I have a form, frmA in database A and I am in datadase B, what is the
>
> best way to open frmA from database B ?
>
> Thanks
>
Message #5 by "John Ruff" <papparuff@c...> on Fri, 7 Jun 2002 09:35:35 -0700
|
|
Sorry Howard,
There are two mistakes in the code I gave you.
1. The Const strPathToForm = "F:\Customer\Service\Source" should be
Const strPathToForm = "F:\Customer\Service\Source\"
(Add a back-slash as the last character)
You forgot to open the Access window with the following code:
' Open database in Microsoft Access window.
appAccess.OpenCurrentDatabase strConPathToSamples
2. But change the appAccess.OpenCurrentDatabase strConPathToSamples to
appAccess.OpenCurrentDatabase strDB
(Do not use strConPathToSamples as it only is the path to the
db)
John Ruff - The Eternal Optimist :-)
Always Looking for a Contract Opportunity
xxx.xxx.xxxx
9306 Farwest Dr SW
Lakewood, WA 98498
-----Original Message-----
From: Howard Stone [mailto:ququmber@h...]
Sent: Friday, June 07, 2002 4:51 PM
To: Access
Subject: [access] RE: opening a form in another database
Thanks John:
The db is located on a network and all the db are on the F drive. After
creating a command button and copying the procedure exactly as
written I got an error message "The command or action "OpenForm" is'nt
available now". Error message 2046.
This is what I have:
Dim strDB As String
Const strPathToForm = "F:\Customer\Service\Source"
strDB = strPathToForm & "MainDB.mdb"
Dim appAccess As New Access.Application
'Create new instance of Access
Set appAccess = CreateObject("Access.Application")
appAccess.DoCmd.OpenForm "frmMainData"
Any furthers insight?
Thanks
> Try this (from MSDN),
Dim appAccess As Access.Application
Dim strDB As String
' Initialize string to database path.
Const strConPathToSamples = "C:\Program Files\Office
2K\Office\Samples"
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"
John Ruff - The Eternal Optimist :-)
Always Looking for a Contract Opportunity
xxx.xxx.xxxx
9306 Farwest Dr SW
Lakewood, WA 98498
-----Original Message-----
From: Howard Stone [mailto:ququmber@h...]
Sent: Thursday, June 06, 2002 3:55 PM
To: Access
Subject: [access] opening a form in another database
If I have a form, frmA in database A and I am in datadase B, what is the
best way to open frmA from database B ?
Thanks
|
 |