Importing spreadsheet to a table from a button?

7

72185

We recieve information atleast once a week if not more. Instead of
having to import the table manualy into a already existing table I was
wanting to know if there would be anyway that I could just go to a
form that contains a button that says "Import" or whatever we decided
to label it as and when you select the button, it will have a code or
command (I figure a code will need to be wrote) to just go and import
the data straight to the table without going through the wizard or
anything else. Although if the wizard did have to be used it wouldn't
be that big of a deal. If anyone has any type or idea of how to go
about this please let me know. Thanks

-WS
 
M

Maurice

If the file is the same you could save your importspecification.

When starting the wizard you'll see an option called "Advanced". Opening
this will walk you through the option to create a importspecification. when
done click save the importspec and close the wizard.

On a form place a button:

in code (e.g. on click) place

DoCmd.TransferSpreadsheet acImport, acSpreadsheet, "yourtablename", "your
filename from importspec"

remark: if you type this in code you'll see the various option popup through
intellisense. Use this instead of copying the code. That way you can see what
the different options are.

hth
 
M

Maurice

btw, it's not appropriate to post your question about 5 times. Please post it
once and you'll be surprised on the feedback you'll get. I noticed that quit
a few volunteers already presented you with a bunch of solutions.
 
Top