access 64 bit linking tables

plus_stick

New member
Local time
Today, 18:36
Joined
Jul 10, 2013
Messages
7
Hi.
I have a code for linking tables. It works on Access 32 bit.
I modify the code for 64 bit (include PtrSafe after all Declares, etc...)
But it doesn't work.
When I try to chose database in dialog window, my program closed.
Code:
Public Function GetDbPath(path_name As String) As Integer
    Dim i As Long
    i = MsgBox("The path to database is incorrect" _
    & Chr(13) & "Chose new path?", vbOKCancel + vbExclamation)
    If i <> vbOK Then
      DoCmd.Quit
      Exit Function
    End If
    i = GetDBFileNameDlg(0, path_name)
    If i = 0 Then
      GetDbPath = False
      DoCmd.Quit
      Exit Function
    End If
    GetDbPath = True
End Function
Closed on second DoCmd.Quit block (see attached file).
Please, help me to solve this trouble.
Thanks in advance.
PS. sorry for my english, hope everything is clear
 

Attachments

What is the code for GetDBFileNameDlg?
 
What is the code for GetDBFileNameDlg?
In attach you can see all codes.
Code:
Public Function GetDBFileNameDlg(HWn As Long, fName As String) As Integer
On Error GoTo Err_
Dim l As Long
Dim pOpenfilename As OPENFILENAME
   fName = ""
   GetDBFileNameDlg = False
 
pOpenfilename.lStructSize = Len(pOpenfilename)
pOpenfilename.lpstrFilter = "*.mdb" + Chr(0) + "*.accdb" + Chr(0) + Chr(0)
pOpenfilename.lpstrFile = String(255, Chr(0))
pOpenfilename.nMaxFile = 255
pOpenfilename.lpstrTitle = "Select file"
pOpenfilename.hwndOwner = HWn
pOpenfilename.lpstrInitialDir = "C:\"
l = GetOpenFileName(pOpenfilename)
If l = 1 Then
   fName = pOpenfilename.lpstrFile
   GetDBFileNameDlg = True
End If
Exit_:
   Exit Function
Err_:
    MsgBox Err.Description
    Resume Exit_
End Function
 

Users who are viewing this thread

Back
Top Bottom