Solved

File Select on Access 2003 & windows 7 x64

Posted on 2010-09-08
3
348 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

679 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