Import data into table from Excel using command button

ccepaulb

New member
Local time
Today, 02:15
Joined
Dec 11, 2003
Messages
8
I'm looking for someone to help me with a solution to my problem of importing data into a data table.
What I'd like to do is have a command button on a form. When this button is clicked the records in a table are cleared out. Then I'd like for a browse window to come up to locate an Excel file. The user would select this file and the data would be imported into the data table that was just cleared.
Can this be done without too much trouble?

Thanks, Paul
 
I have attached a copy of a browse database posted by a member
Run the form fFindopenImportFile
This form allows you to browse for a file and uses several modules

You could copy the Form and modules to your dbase . Open the form browse for the file select it and it appears in the blank field
click the import button
Change the If statement to suit your needs and replace the docmd with

DoCmd.TransferSpreadsheet acImport, 8, "Tablenameindatabase", Forms!fFindOpenImportFile!tbFile, True, ""

Imports an excel spreadsheet into the table you have named
if it doesn't exist it creates it
(if it does exist rember to delete it first)

It takes the spreadsheet name and location from the field on the form
 

Attachments

How did this work for you? I'm trying to do the same thing, only I don't want to delete the original data in the table, just add to it. I cannot download the attachment due to firewall issues, and cannot see the code. But I really want to know how to get this working for my DB also.
 
Couldn't make it work

I haven't ben able to get it to work yet, but am still trying to work on it.
If I can get something figured out, I'll let you know.

-Paul
 

Users who are viewing this thread

Back
Top Bottom