Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying File Open Dialog 1

Status
Not open for further replies.

hsp7777

Programmer
Jan 11, 2005
67
US
Greetings,

I am attempting to display the File Open dialog in MS Access (which I've never done before), and am having problems with the following line of code (which I have placed in a Class module):

Private Type OPENFILENAMElStructSize As LonghwndOwner As LonghInstance As LonglpstrFilter As StringlpstrCustomFilter As StringnMaxCustFilter As LongnFilterIndex As LonglpstrFile As StringnMaxFile As LonglpstrFileTitle As StringnMaxFileTitle As LonglpstrInitialDir As StringlpstrTitle As StringFlags As LongnFileOffset As IntegernFileExtension As IntegerlpstrDefExt As StringlCustData As LonglpfnHook As LonglpTemplateName As String
End Type

I keep receiving the error, "Expected: End of statement", when I attempt to compile that class module. I copied the code directly from an article outlining how to display the File Open dialog. The article I am referencing is entitled, "Display Open and Save As Dialog Boxes in Access with API Functions" on the MSDN web site.

At any rate, can anyone tell me what I am doing wrong? Secondly, is there no other way of displaying the "File Open" dialog in Access? In Excel, all I would need is the following line of code:
Application.Dialogs(xlDialogOpen).Show

Thanks in advance!
 
Private Type OPENFILENAME
lStructSize As Longhwnd
Owner As Long
hInstance As Longlpstr
Filter As Stringlpstr
CustomFilter As String
nMaxCustFilter As Long
nFilterIndex As Longlpstr
File As String
nMaxFile As Longlpstr
FileTitle As String
nMaxFileTitle As Longlpstr
InitialDir As Stringlpstr
Title As String
Flags As Long
nFileOffset As Integer
nFileExtension As Integer
lpstrDefExt As String
lCustData As Longlpfn
Hook As LonglpTemplate
Name As String
End Type

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Hi Geoff,

Do you have a code example using the Common Dialog control? I have added it to a blank form, but I see now "ShowOpen" method for it.

Ex:

Private Sub ActiveXCtl1_Updated(Code As Integer)
Me.ActiveXCtl1. (<-- No "ShowOpen" method exits for the control)
End Sub

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top