Runtime error 5

pfriedmann

New member
Local time
Today, 09:58
Joined
Aug 27, 2014
Messages
5
Myself and one other user are getting this error when using a switchboard to go from one database to another. As soon as we switch databases a 'runtime error 5' 'invalid call or argument' appears. No other users get the error at all. The difference is that everyone else is using 32bit windows and me and the other guy is using 64 bit windows. I am new here and the guy the created the database and wrote the VBA code is no longer here (I am the guy that took his place). I can not figure this out, any help would great awesome, thanks
 
Is a particular line of code highlighted?
 
The code below is highlighted (just the blue)

Private Sub OpenDatabaseFile(strDatabaseName As String, strDatabasePath As String)
Shell Chr(34) & FindAccessFileLocation & Chr(34) _
& " " & Chr(34) & strDatabasePath & strDatabaseName & Chr(34),
vbMaximizedFocus
DoCmd.Quit acQuitSaveNone
End Sub
 
Most likely because your FindAccessFileLocation function is not finding the access location.
 
Then why does that error only occur on machines using 64bit Windows?
 
Can you show the code for the FindAccessFileLocation? Also if you have declared the Library for Shell in your code, show that too.
 
The 32 bit folder for Access is different for the 64 bit folder and I think this is what you're doing. You can use the registry to find the current Access version.

But yes, let's still see the function like pr2-eugin requested.
 
Here is the entire code, I find it strange that this error only occurs with 64bit Windows.

Private Function FindAccessFileLocation() As String
On Error Resume Next
'this is to handle server utilization, as well as client machines
Dim varReturnValue As Variant
varReturnValue = FileDateTime("C:\Program Files\Microsoft Office\Office14\MSACCESS.exe")
'test 1
If IsNull(varReturnValue) Then
GoTo NOT_FOUND
ElseIf (varReturnValue) = "" Then
GoTo NOT_FOUND
Else
FindAccessFileLocation = "C:\Program Files\Microsoft Office\Office14\MSACCESS.exe"
GoTo EXIT_CALLER
End If
NOT_FOUND:
'test 2
varReturnValue = FileDateTime("E:\Program Files\Microsoft Office\Office14\MSACCESS.exe")
If IsNull(varReturnValue) Then
GoTo EXIT_CALLER
ElseIf (varReturnValue) = "" Then
GoTo EXIT_CALLER
Else
FindAccessFileLocation = "E:\Program Files\Microsoft Office\Office14\MSACCESS.exe"
End If
EXIT_CALLER:
Set varReturnValue = Nothing
End Function

Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" _
(ByVal lpBuffer As String, nSize As Long) As Long
 
This is not a shortcut issue. On the file server there a 4 relationalship databases with a switchboard to log of and go between each one. Example is when I am on the productivity database and I go back to the switchboard to go to the employee database, the error occurs when I switch databases. Clicking on and shortcuts or icons to switch databases, the only shortcut I click on is to open one of the databases up. All 4 database will open up when the respected shortcut is clicked, the problem is just with the switchboard part of it.
 

Users who are viewing this thread

Back
Top Bottom