Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

File Select on Access 2003 & windows 7 x64

Posted on 2010-09-08
3
Medium Priority
?
368 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 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
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 …

926 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