Solved

File Select on Access 2003 & windows 7 x64

Posted on 2010-09-08
3
339 Views
Last Modified: 2012-05-10
Just upgraded my OS to 64-bit Windows 7. Now getting an error when trying to run the File Select control.

FileSelection.Filter = "All Files (*.*)|*.*"

gives an error "Run-Time error '438'. Object doesn't support this property or method". Works fine with 32-bit OS
Am I missing a reference? dll? other?
0
Comment
Question by:HSdba
  • 3
3 Comments
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 33634378
Have you tried this standard code.
It is old, but it is still frequently quoted and used here.:
http://www.mvps.org/access/api/api0001.htm

;-)

JeffCoachman
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 500 total points
ID: 33634437
Or this similar code I found long ago:

'Needed for FileToOpen function
Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As gFILE) As Long
Type gFILE
 lStructSize As Long
 hwndOwner As Long
 hInstance As Long
 lpstrFilter As String
 lpstrCustomFilter As String
 nMaxCustFilter 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


Function FileToOpen(Optional StartLookIn) As String

Dim OFN As gFILE
Dim path As String
Dim FileName As String
Dim a As String

StartOver:
OFN.lStructSize = Len(OFN)
'Set the Dialog box filters
OFN.lpstrFilter = "All PFD Files (*.pdf)" + Chr$(0) + "*.pdf" + Chr$(0)
OFN.lpstrFile = Space$(254)
OFN.nMaxFile = 255
OFN.lpstrFileTitle = Space$(254)
OFN.nMaxFileTitle = 255


    'Sets what Directory (Folder) the Dialog box opens to by default
    If Not IsMissing(StartLookIn) Then
        'This is typically the "Desktop"
        OFN.lpstrInitialDir = StartLookIn
    'Else
        'Or provide your own start-up location-Folder
        'OFN.lpstrInitialDir = "C:\YourFolder"
    End If

'Sets the Dialog box Title Bar text.
OFN.lpstrTitle = "Locate and select the PDF File"
OFN.Flags = 0

a = GetOpenFileName(OFN)
    If (a) Then
        path = Trim(OFN.lpstrFile)
        FileName = Trim(OFN.lpstrFileTitle)
        If Dir(path) <> "" Then FileToOpen = -1
        FileToOpen = Trim(OFN.lpstrFile)
    Else
        FileToOpen = ""
        path = ""
        FileName = ""
    End If

FileToOpen = path

End Function
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 33667982
;-)
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question