3rd access db won't open at runtime

craigachan

Registered User.
Local time
Today, 04:31
Joined
Nov 9, 2007
Messages
285
I have 3 modules to my user interface that connect to my backend. Each module is a separate front end access accdb. I have coded some buttons to open each of these modules which work well in the developers version. But at runtime, I can only open two of them. The funny thing is this. Say I have Module1 open, then click on a button to open module2 at runtime. The second one opens fine. If I try to open module3, the button won't respond at all. If I close Module2, I still can't open Module 3 from that time on. If I put a separate desktop shortcut to Module3, it will open. I also can have Module1 and Module2 open at the same time. And Module3 will open but only if it is launched from the desktop shortcut.

I'm wondering what causes this. and how to work around this. Its annoying because I now have to put desktop shortcuts to all of the modules on each of our workstations rather than run all of them from my menu buttons.
 
Do you've some code behind the buttons which prevent from open when one of the other is open?
Show the code you use for open each database.
What if you start opening the 3. database, could the other open then?
 
Here is my code:

Implant Module
Code:
Private Sub cmdImplant_Click()
    
'FN = File Name
' PTFILE = Path to File

Dim FN As String
Dim PTFile As String

FN = DLookup("AOMSImplant", "CHANLinkPaths")   
PTFile = ""

Me.tfPtInfo = Me.PName & vbCrLf & Me.nPID & vbCrLf & Me.nRef
Me.tfPtInfo.SetFocus                        'These lines for helping to send info to other applications
DoCmd.RunCommand acCmdCopy
Me.aa.SetFocus

Call Launch(FN, PTFile)

End Sub

Surgery Module:
Code:
Private Sub cmdSurg_Click()
On Error GoTo cmdSurg_ClickErr
'FN = File Name
' PTFILE = Path to File

Dim FN As String
Dim PTFile As String

FN = DLookup("AOMSSurgery", "CHANLinkPaths")   
PTFile = ""

Call Launch(FN, PTFile)    'may not work with Win7

cmdSurg_ClickExit:
    Exit Sub
cmdSurg_ClickErr:
    MsgBox "cmdSurg_Click" & vbCrLf & Err.Number & ": " & Err.Description
    Resume cmdSurg_ClickExit
    
End Sub

Letter Module:

Code:
Private Sub cmdLtr_Click()

On Error GoTo cmdLtr_ClickErr
'FN = File Name
' PTFILE = Path to File

Dim FN As String
Dim PTFile As String

FN = DLookup("AOMSLtr", "CHANLinkPaths")  
PTFile = ""

Me.tfPtInfo = Me.PName & vbCrLf & Me.nPID & vbCrLf & Me.nRef
Me.tfPtInfo.SetFocus                        'These lines for helping to send info to other applications
DoCmd.RunCommand acCmdCopy
Me.aa.SetFocus
'Call LaunchApp(FN)  'Public - In Win7 ActiveX problems
Call Launch(FN, PTFile) 'Public Doesnt work with Win7

cmdLtr_ClickExit:
    Exit Sub
cmdLtr_ClickErr:
    MsgBox "cmdLtr_Click" & vbCrLf & Err.Number & ": " & Err.Description
    Resume cmdLtr_ClickExit

End Sub

Please Note: Once the 2nd module has opened, the third one won't launch, even though you close the second module.
 
In your code you are calling a procedure "Call Launch(FN, PTFile)", which you do not show! Which code do you use for open database no. 3, you show 3 pieces of code, but not telling which order of database they open?
 
Sorry for the confusion. Let me paint a new picture of my situation in different terms and perhaps this might be clearer.

I have a main access db called 'AOMSCharts'. On the main form I have buttons, much like a menu, that are coded to open another access db, 'AOMSImplant.accdb', 'AOMSSurgery.accdb', 'AOMSLtr.accdb'. The code for these buttons are listed above. AOMSCharts is always open. At runtime, if the user clicks on the button for AOMSImplant it opens, no problem. Now with these two open, if the same user on the same workstation clicks on menu button, say AOMSLtr, nothing happens. If the same user clicks on the desktop shortcut that I made to AOMSLtr.accdb, it will open.

Add'l scenario: User has AOMSChart open. clicks on button, say AOMSLtr...it opens. Then clicks on a third button, say AOMSSurgery, nothing happens. Closes AOMSLtr and then trys to click AOMSSurgery, still nothing. But each of these will work thru windows desktop shortcuts. User can still open from AOMSCharts, in this scenario, AOMSLtr all she wants regardless of whether the others are open or not.

It really doesn't seem to matter which button they click and in which order. What seems to be consistent is which one is the second to open and the third to open.

Here is my launch code
Code:
Public Function LaunchFile(FN As String, PTFile As String)
On Error GoTo LaunchFileErr
' FN = File Name
' PTFILE = Path to File
LaunchFile = ShellExecute(0, "open", FN, "", PTFile, 1)

LaunchFileExit:
    Exit Function
LaunchFileErr:
    MsgBox "ChartPublic-LaunchFile: " & Err.Number & "-" & Err.Description
    Resume LaunchFileExit
End Function

Hope this helps make it clearer. Thanks for your help.
 
Can't you use CreateObject("Access.Application") in a runtime version, instead of ShellExecute?
 
Thanks for the suggestion on CreateObject. Which dll or reference do I need to do this. I'm getting Runtime 429.
 

Users who are viewing this thread

Back
Top Bottom