INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Access Howto:

Importing Excel 97 Files From Changing Locations by famousb
Posted: 24 May 00

Importing of Excel 97 files when you want the user to be prompted for file name and location to allow for changing directories and file names - but always to the same Access table (this is with the first example from the FAQ - Importing Excel 97 Files Into Access Using VB Code).

The following names would need to be added or changed depending upon your database, but the punctuation would remain:

AccessTableName = The name of the table in your database to which you wish to add the records.
TitleOfMessageBox = The title you wish to have on your message box.
YouCanAddDefaultLocationHere = If you want to give the user a default location from which to import.

Importing of Excel 97 files when you want the user to be prompted for file name and location to allow for changing directories and file names, but always to the same Access table.  This is to import the entire first worksheet if it does not have Field Names included, to include field names change the last "0" to "-1"

You would use a series of statements as such:
Dim Message, Default, PathValue, Message2, FileValue As String
Dim Title
Message = "Enter the path name."
Message2 = "Enter the file name."
Title = "TitleOfMessageBox"
Default = "YouCanAddADefaultLocationHere"
FileValue = InputBox(Message2, Title, Default)
PathValue = InputBox(Message, Title, Default) & FileValue
DoCmd.TransferSpreadsheet acImport, 8, "AccessTableName", PathValue, 0

Back to Microsoft: Access Other topics FAQ Index
Back to Microsoft: Access Other topics Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close