Discussion Locked

MsAccess 97- How do I get a file window?

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I would like to get a file window open through MsAccess 97....any ideas?

What I actually need is for the user to be presented with a window from which he can a file and I will then grab the filename and location and link to it as a link table.Thanks...

5 replies

by peyison

First, you need to include an instance of the Microsoft Common Dialog Control on your form. From the forms toolbox select the "More Controls" button (lower right). From the list of controls, select "Common Dialogs Control". Then click on your form to add it. This control will be hidden when the form is diplayed.

Next add the code to call the Open File dialog. In this example, the Common Dialog control is named cdDialog.

Private Sub cbtOpenFile_Click()
Dim sFileName As String

cdDialog.Flags = cdlOFNFileMustExist
cdDialog.Filter = "Access File (*.mdb)|*.mdb"
cdDialog.ShowOpen
sFileName = cdDialog.FileName
MsgBox sFileName
End Sub

You can also use this control to pop a "Save File" dialog (cdDialog=ShowSave), and Color, Font, Help and Printer dialogs (ShowColor, ShowFont, ShowHelp, ShowPrinter)

There are many flags available - like cdlOFNFileMustExist used above. If you have VB you can look in help for all of the options. If you don't, I can email the list of flags, and any examples from VB Help.

Hope this helps.

This discussion is closed to new replies.