Learn how to a build a cloud-first strategyRegister Now


Get Path from User before using transferspreadsheet to import Excel into Access.

Posted on 2005-05-12
Medium Priority
Last Modified: 2006-11-18
My application calls for the user to enter the path were the excel files will be kept.  I need to make a constant out of whatever path they set.  I know how to get the path, and store it in a table.  But what does the code look like to automate the import?

I'm using the TransferSpreadsheet command.  It works if I hardcode all of the paths.  But everyone's path will be different.
Question by:rimbaugk
  • 3

Expert Comment

ID: 13991447
Based on the way you are getting the path, and storing it in the table, are you suggesting that all paths for all users will be stored in a table, and you want the code to look at that table and use the path listed for the current user to docmd.transferspreadsheet?

Or what?

Author Comment

ID: 13991516
There is a table called setup that has one field called path.  I figured I'd use a form to have the user input a path the first time they use the database.  The import process then has to look at that table to determine where to look for the files.  Does that make sense?

Accepted Solution

manthanein earned 2000 total points
ID: 13991517
well....   then  get your  table  with the userpath ready..     all you need to  do is use   dlookup()  statement ..  it is used something like this  

strpath =  dlookup("[PathField]", "tblPathTable","[UserID]=" & SomeVar )

hope you can use this

Author Comment

ID: 13991536
I'll try this and get back to you soon.  Thanks for the input.

Author Comment

ID: 13995382
It worked.  Thank you very much.

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question