Need some VB coding Help with routing to multiple Dbases

  • Thread starter Thread starter FTE
  • Start date Start date
F

FTE

Need some VB coding Help with routing to multiple Dbases.
I have 17 individual Data bases that all use a similar
front end. I have basicly created a single Dbase interface
that links all of the other 17 Dbases as sort of a task
router to the appropriate DBase. What I am looking for is
some code or an example of how the code looks for a series
of command buttons 1 thru 17 that will open only the DATA
BASE that I am trying to work with. Sort of a Hyperlink if
you will. MACROS will not give me the effect that I want
so I am trying to work this out with some VB. Please Help!
Thanks
 
Take a look at the Shell() function. You should be able
to simply point to the desired .mdb file and use Shell()
to open it.

Rob
 
Thanks for the Idea. However, Been there done that. The
Problem with this approach is that I am operating in a
NETWORK environment. The Base MSACCESS.EXE resides on a
different drive that does the other DBASE's ie. the *.mdb
files. When I use the following code I can open up a DBASE
from a list of files and or other drives. However, I want
it to open up the selected mdb from the code string.

Code below:

Function CHOOSE_ACFT_MACRO()
On Error GoTo CHOOSE_ACFT_MACRO_Err
Dim RetVal
If (Forms![Choose Acft form]!Aircraft = 1) Then RetVal
= Shell("C:\Program Files\Microsoft
Office\Office\MSACCESS.EXE")
DoCmd.Close acForm, "Choose Acft form"
CHOOSE_ACFT_MACRO_Exit:
Exit Function
CHOOSE_ACFT_MACRO_Err:
MsgBox Error$
Resume CHOOSE_ACFT_MACRO_Exit

End Function

What I want to make work is below:
Function CHOOSE_ACFT_MACRO()
On Error GoTo CHOOSE_ACFT_MACRO_Err
Dim RetVal
If (Forms![Choose Acft form]!Aircraft = 1) Then RetVal
= Shell("F:\XYZ\J1\J1.mdb")
DoCmd.Close acForm, "Choose Acft form"
CHOOSE_ACFT_MACRO_Exit:
Exit Function
CHOOSE_ACFT_MACRO_Err:
MsgBox Error$
Resume CHOOSE_ACFT_MACRO_Exit

End Function

THE PROBLEM:
WHEN I run this code it gives me an error that
says, "Invalid Procedure call or argument"

So I say, "@#$%*&^" NOW What?
 
Shell will only take a executable name, such as an .exe file, .bat file,
etc. You could string the path to msaccess.exe together with the database
file and full path, but it would be easier to try :

Application.FollowHyperlink "F:\XYZ\J1\J1.mdb"

or

Application.FollowHyperlink strDatabase


FollowHyperlink will open the specified file its associated program (similar
to a double-click from Explorer.)

HTH,

Kevin

FTE said:
Thanks for the Idea. However, Been there done that. The
Problem with this approach is that I am operating in a
NETWORK environment. The Base MSACCESS.EXE resides on a
different drive that does the other DBASE's ie. the *.mdb
files. When I use the following code I can open up a DBASE
from a list of files and or other drives. However, I want
it to open up the selected mdb from the code string.

Code below:

Function CHOOSE_ACFT_MACRO()
On Error GoTo CHOOSE_ACFT_MACRO_Err
Dim RetVal
If (Forms![Choose Acft form]!Aircraft = 1) Then RetVal
= Shell("C:\Program Files\Microsoft
Office\Office\MSACCESS.EXE")
DoCmd.Close acForm, "Choose Acft form"
CHOOSE_ACFT_MACRO_Exit:
Exit Function
CHOOSE_ACFT_MACRO_Err:
MsgBox Error$
Resume CHOOSE_ACFT_MACRO_Exit

End Function

What I want to make work is below:
Function CHOOSE_ACFT_MACRO()
On Error GoTo CHOOSE_ACFT_MACRO_Err
Dim RetVal
If (Forms![Choose Acft form]!Aircraft = 1) Then RetVal
= Shell("F:\XYZ\J1\J1.mdb")
DoCmd.Close acForm, "Choose Acft form"
CHOOSE_ACFT_MACRO_Exit:
Exit Function
CHOOSE_ACFT_MACRO_Err:
MsgBox Error$
Resume CHOOSE_ACFT_MACRO_Exit

End Function

THE PROBLEM:
WHEN I run this code it gives me an error that
says, "Invalid Procedure call or argument"

So I say, "@#$%*&^" NOW What?

-----Original Message-----
Take a look at the Shell() function. You should be able
to simply point to the desired .mdb file and use Shell()
to open it.

Rob

.
 
If the client PC's have the .mdb extension associate with
Access, you shouldn't need to point to the MSACCESS.EXE
file itself - just point to the .mdb file and Windows will
open Access automatically.

If that won't work for you, you can use the path and file
name for the .mdb file as a command line argument as part
of the call to Access - something like

=Shell("C:\Program Files\Microsoft Office\Office\
MSACCESS.EXE {path to .mdb file here}")

Look up "command;line" in the help file and select the
Startup command-line options topic.

Rob


-----Original Message-----
Thanks for the Idea. However, Been there done that. The
Problem with this approach is that I am operating in a
NETWORK environment. The Base MSACCESS.EXE resides on a
different drive that does the other DBASE's ie. the *.mdb
files. When I use the following code I can open up a DBASE
from a list of files and or other drives. However, I want
it to open up the selected mdb from the code string.

Code below:

Function CHOOSE_ACFT_MACRO()
On Error GoTo CHOOSE_ACFT_MACRO_Err
Dim RetVal
If (Forms![Choose Acft form]!Aircraft = 1) Then RetVal
= Shell("C:\Program Files\Microsoft
Office\Office\MSACCESS.EXE")
DoCmd.Close acForm, "Choose Acft form"
CHOOSE_ACFT_MACRO_Exit:
Exit Function
CHOOSE_ACFT_MACRO_Err:
MsgBox Error$
Resume CHOOSE_ACFT_MACRO_Exit

End Function

What I want to make work is below:
Function CHOOSE_ACFT_MACRO()
On Error GoTo CHOOSE_ACFT_MACRO_Err
Dim RetVal
If (Forms![Choose Acft form]!Aircraft = 1) Then RetVal
= Shell("F:\XYZ\J1\J1.mdb")
DoCmd.Close acForm, "Choose Acft form"
CHOOSE_ACFT_MACRO_Exit:
Exit Function
CHOOSE_ACFT_MACRO_Err:
MsgBox Error$
Resume CHOOSE_ACFT_MACRO_Exit

End Function

THE PROBLEM:
WHEN I run this code it gives me an error that
says, "Invalid Procedure call or argument"

So I say, "@#$%*&^" NOW What?

-----Original Message-----
Take a look at the Shell() function. You should be able
to simply point to the desired .mdb file and use Shell()
to open it.

Rob

.
.
 
Thanks KEVIN and ROB
The Application.FollowHyperlink "F:\XYZ\J1\J1.mdb"
approach seems to have been my ticket!!!

You guys RAWK
-----Original Message-----
Shell will only take a executable name, such as an .exe file, .bat file,
etc. You could string the path to msaccess.exe together with the database
file and full path, but it would be easier to try :

Application.FollowHyperlink "F:\XYZ\J1\J1.mdb"

or

Application.FollowHyperlink strDatabase


FollowHyperlink will open the specified file its associated program (similar
to a double-click from Explorer.)

HTH,

Kevin

Thanks for the Idea. However, Been there done that. The
Problem with this approach is that I am operating in a
NETWORK environment. The Base MSACCESS.EXE resides on a
different drive that does the other DBASE's ie. the *.mdb
files. When I use the following code I can open up a DBASE
from a list of files and or other drives. However, I want
it to open up the selected mdb from the code string.

Code below:

Function CHOOSE_ACFT_MACRO()
On Error GoTo CHOOSE_ACFT_MACRO_Err
Dim RetVal
If (Forms![Choose Acft form]!Aircraft = 1) Then RetVal
= Shell("C:\Program Files\Microsoft
Office\Office\MSACCESS.EXE")
DoCmd.Close acForm, "Choose Acft form"
CHOOSE_ACFT_MACRO_Exit:
Exit Function
CHOOSE_ACFT_MACRO_Err:
MsgBox Error$
Resume CHOOSE_ACFT_MACRO_Exit

End Function

What I want to make work is below:
Function CHOOSE_ACFT_MACRO()
On Error GoTo CHOOSE_ACFT_MACRO_Err
Dim RetVal
If (Forms![Choose Acft form]!Aircraft = 1) Then RetVal
= Shell("F:\XYZ\J1\J1.mdb")
DoCmd.Close acForm, "Choose Acft form"
CHOOSE_ACFT_MACRO_Exit:
Exit Function
CHOOSE_ACFT_MACRO_Err:
MsgBox Error$
Resume CHOOSE_ACFT_MACRO_Exit

End Function

THE PROBLEM:
WHEN I run this code it gives me an error that
says, "Invalid Procedure call or argument"

So I say, "@#$%*&^" NOW What?

-----Original Message-----
Take a look at the Shell() function. You should be able
to simply point to the desired .mdb file and use Shell ()
to open it.

Rob

-----Original Message-----
Need some VB coding Help with routing to multiple Dbases.
I have 17 individual Data bases that all use a similar
front end. I have basicly created a single Dbase
interface
that links all of the other 17 Dbases as sort of a task
router to the appropriate DBase. What I am looking for is
some code or an example of how the code looks for a
series
of command buttons 1 thru 17 that will open only the DATA
BASE that I am trying to work with. Sort of a Hyperlink
if
you will. MACROS will not give me the effect that I want
so I am trying to work this out with some VB. Please Help!
Thanks
.

.


.
 
Back
Top