Solved

File Select on Access 2003 & windows 7 x64

Posted on 2010-09-08
3
358 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

624 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