OpenFileName 64-Bit (1 Viewer)

GWI

New member
Local time
Today, 00:54
Joined
Oct 13, 2021
Messages
3
Good morning All,

i have been struggling for weeks trying to get a legacy database originally written in access 2000 up to be used in Access 2016 64-bit and thought i had finally got there as all looked to be working, however when i click on any links that would normally open a box to link a file like a pdf to the database it does nothing, I've tried all the comments around about changing the code but having no luck and by the sounds off it its coming from the following code;

Option Compare Database
Option Explicit

Public Type OPENFILENAME
lStructSize As Long
hwndOwner As Long
hInstance As Long
lpstrFilter As String
lpstrCustomFilter As String
nMaxCustomFilter As Long
nFilterIndex As Long
lpstrFile As String
nMaxFile As Long
lpstrFileTitle As String
nMaxFileTitle As Long
lpstrInitialDir As String
lpstrTitle As String
Flags As Long
nFileOffset As Integer
nFileExtension As Integer
lpstrDefExt As String
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type
Public Const OFN_HIDEREADONLY = &H4
Public Const OFN_OVERWRITEPROMPT = &H2
Public Const OFN_PATHMUSTEXIST = &H800
Public Declare PtrSafe Function GetSaveFileName Lib "comdlg32.dll" Alias "GetSaveFileNameA" (lpOFN _
As OPENFILENAME) As Long

Public Declare PtrSafe Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (lpOFN _
As OPENFILENAME) As Long

Public Declare PtrSafe Function aht_apiGetOpenFileName Lib "comdlg32.dll" _
Alias "GetOpenFileNameA" (lpOFN As OPENFILENAME) As Long

Public Declare PtrSafe Function aht_apiGetSaveFileName Lib "comdlg32.dll" _
Alias "GetSaveFileNameA" (lpOFN As OPENFILENAME) As Long

Public Declare PtrSafe Function CommDlgExtendedError Lib "comdlg32.dll" () As Long

Global Const ahtOFN_READONLY = &H1
Global Const ahtOFN_OVERWRITEPROMPT = &H2
Global Const ahtOFN_HIDEREADONLY = &H4
Global Const ahtOFN_NOCHANGEDIR = &H8
Global Const ahtOFN_SHOWHELP = &H10
' You won't use these.
'Global Const ahtOFN_ENABLEHOOK = &H20
'Global Const ahtOFN_ENABLETEMPLATE = &H40
'Global Const ahtOFN_ENABLETEMPLATEHANDLE = &H80
Global Const ahtOFN_NOVALIDATE = &H100
Global Const ahtOFN_ALLOWMULTISELECT = &H200
Global Const ahtOFN_EXTENSIONDIFFERENT = &H400
Global Const ahtOFN_PATHMUSTEXIST = &H800
Global Const ahtOFN_FILEMUSTEXIST = &H1000
Global Const ahtOFN_CREATEPROMPT = &H2000
Global Const ahtOFN_SHAREAWARE = &H4000
Global Const ahtOFN_NOREADONLYRETURN = &H8000
Global Const ahtOFN_NOTESTFILECREATE = &H10000
Global Const ahtOFN_NONETWORKBUTTON = &H20000
Global Const ahtOFN_NOLONGNAMES = &H40000
' New for Windows 95
Global Const ahtOFN_EXPLORER = &H80000
Global Const ahtOFN_NODEREFERENCELINKS = &H100000
Global Const ahtOFN_LONGNAMES = &H200000













Public Declare PtrSafe Function MoveFile Lib "kernel32.dll" Alias "MoveFileA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String) As Long
Function FormattedMsgBox( _
Prompt As String, _
Optional Buttons As VbMsgBoxStyle = vbOKOnly, _
Optional Title As String = vbNullString, _
Optional HelpFile As Variant, _
Optional conText As Variant) _
As VbMsgBoxResult

If Title = "" Then
Title = "Vault"
End If

If IsMissing(HelpFile) Or IsMissing(conText) Then
FormattedMsgBox = Eval("MsgBox(""" & Prompt & _
""", " & Buttons & ", """ & Title & """)")
Else
FormattedMsgBox = Eval("MsgBox(""" & Prompt & _
""", " & Buttons & ", """ & Title & """, """ & _
HelpFile & """, " & conText & ")")
End If
End Function



Would anyone know where I'm going wrong and is there away to get the links in my database to open on clicking them to ab able to attach pdfs to it again?

Thanks in advance
Graeme
 

Minty

AWF VIP
Local time
Today, 00:54
Joined
Jul 26, 2013
Messages
8,900
Could you edit that to put the code into Code tags? Press the </> button in the editor.
And try and add some indenting to it to make it more readable?

Are you trying to save an attachment INTO the database or simply a link to the path to the file?
 

GWI

New member
Local time
Today, 00:54
Joined
Oct 13, 2021
Messages
3
Hi Minty,

Thanks for getting back to me, I'm a little new to this and been learning as i go. I've generally been using visual basic editor to change the code but will take a look and see if i can do this then post it back.

it would link the pdf to the database, pretty much it tracks it in the tables and stores the file in a specified folder within the C drive
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 08:54
Joined
May 7, 2009
Messages
14,556
of course there is always an x64 version:
 

Attachments

  • New Text Document.txt
    16.3 KB · Views: 75

GWI

New member
Local time
Today, 00:54
Joined
Oct 13, 2021
Messages
3
Thank you for the comments, i will go give this a try this afternoon :)
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 19:54
Joined
Feb 19, 2002
Messages
33,677
In the long run, you are better off avoiding API code if there are other options.
 

Users who are viewing this thread

Top Bottom