How Do I Allow Users to Input Paths?

G

Guest

My latest question:

I have a series of buttons that export data to Excel using the
DoCmd.TransferSpreadsheet command. This works fine. However, we want to
allow users to choose which Excel file the export to. I have added a textbox
that allows users to click on, and it opens the acCmdInsertHyperlink dialouge
box that allows the user to input a path.

Then, my program replaces the default path for the Excel file with the one
the user prefers. The problem is, my actual path is something like
"C:\Program Files\File.xls", the program comes up with a hyperlink like
"../../Program Files/File.xls", and when my program tries to export, it reads
it as "C:\Dustin's Stuff\Program Files\Program Files\File.xls", which is a
majorly messed-up combination of the application location and the path it
should be using.

Any idea why it's doing this and how to fix it?

Problem #2...if the path the user tries to input is too long...such as
"C:\Program Files\RiskAmp\Bart Simpson\Test.xls", no hyperlink is saved at
all and no error message is displayed. Any idea why?

Thanks!

Dustin
 
D

Dirk Goldgar

Dustin Ventin said:
My latest question:

I have a series of buttons that export data to Excel using the
DoCmd.TransferSpreadsheet command. This works fine. However, we
want to allow users to choose which Excel file the export to. I have
added a textbox that allows users to click on, and it opens the
acCmdInsertHyperlink dialouge box that allows the user to input a
path.

Then, my program replaces the default path for the Excel file with
the one the user prefers. The problem is, my actual path is
something like "C:\Program Files\File.xls", the program comes up with
a hyperlink like "../../Program Files/File.xls", and when my program
tries to export, it reads it as "C:\Dustin's Stuff\Program
Files\Program Files\File.xls", which is a majorly messed-up
combination of the application location and the path it should be
using.

Any idea why it's doing this and how to fix it?

Problem #2...if the path the user tries to input is too long...such as
"C:\Program Files\RiskAmp\Bart Simpson\Test.xls", no hyperlink is
saved at all and no error message is displayed. Any idea why?

Thanks!

Instead of mucking about with hyperlinks, why not call the Windows File
Open/Save API directly, using the code at:

www.mvps.org/access/api/api0001.htm
 
G

Guest

That is a lot of code to make that one stinkin' window pop up...but it works,
so thanks!

Dustin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top