Solved

File Select on Access 2003 & windows 7 x64

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
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…

759 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now