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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Want to set directories for file lookup

Status
Not open for further replies.

Gunny

Programmer
Feb 15, 2001
5
US
In my program I have two forms to select a file for import. One form imports an orders file and the other imports a package ID file. These files are located in specific directories (orders file in an Orders directory and Package IDs in a package ID directory) When the user clicks on the file open button (in either form) they are in the default directory and have to go to the directory where the file is located and then select the file. I would like to set the directories for the forms. What code can I do this with? Thanks!
 
Gunny - if you are using the CommonDialog Control to open the files then you can use the InitDir property. For Example if you CommonDialog Control is named acxOpen then:

acxOpen.InitDir = "C:\Program Files\"

HTH,
JC

 
Mongooses - I do not know about the CommonDialog Control. This is the code that runs the command button that is clicked to get the file. There is a module called "File Utilities" that works with the import forms but I am new to this and haven't figured out the connection..Any other answers?

Private Sub OpenTableSelector_Click()
'Use file open dialog to select file
On Error GoTo ErrorHandler
Me.File1 = OpenFile(Me.File1)
GoTo Done

ErrorHandler:
MsgBox "Error: " & Err.Description & " (" & Err.Number & ")"

Done:
Exit Sub
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top