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

Hi, In order for me to import t

Status
Not open for further replies.

sabavno

Programmer
Jul 25, 2002
381
CA
Hi,

In order for me to import the excel file into the Access 97 table, I have to take the exact path to the file from the user (which I do using a text box)

txtPath.SetFocus
path = txtPath.Text
DoCmd.TransferSpreadsheet acImport, , "1", path, True


But that is of course a headache for the user to type the whole path into the text box.

How could I open a windows dialog box so the user would browse for the file?

Please help.

Thanks

 
You can use a common dialog control. drop this onto your form and give it a name such as 'opendlg'.

Then you can open up the control with a simple command like this:

Me![opendlg].ShowOpen

You can get the filename out by using the code below:

Me![opendlg].FileName

You may want to check that the file name is not null before doing anything with it.

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top