Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running Import Wizard from VBA 2

Status
Not open for further replies.

Rafool

Technical User
Sep 23, 2002
12
IL
Hi,

I've seen a lot of posts on tek-tips about how to import files using TransferText or TransferDatabase, etc. But how do I simply open the Import Wizard (File, Get External Data, Import) from Visual Basic code?

Thanks.
 
Have you tried this ?
DoCmd.RunCommand acCmdImport

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks for the help, PHV, that was what I was looking for.

Unfortunately, my boss just made the specs much harder, so now I need some advice from anyone about the best way to approach this problem.

I have code written that will take address information, parse it/clean it up, and output that clean information into a new table. My boss wants a GUI that will let him import any file and have that file automatically cleaned up/parsed and exported to a new file. That would have been fine with the DoCmd.RunCommand acImport

The problem is that these random tables/files he'll want to import will have other fields/columns that I don't need, and he wants those preserved in the final file. In other words, each record will start with the first 7 fields I need for my parsing code, but will have an arbitrary number of other fields for each record, and once each record is cleaned, those other fields need to be included with each relevant record. So I thought acImport would be helpful, and I would just import the first 7 fields I need into my existing table and ignore the rest of the fields. But now that there is an arbitrary number of other fields, I can't use an existing table's framework to store the information.

Any ideas as to how I should approach this, importing the data with the arbitrary number of extra columns and storing those extra columsn with each record as it's parsed (each parsed record is stored to a new table with recordset.addnew

Thanks so much!
 
I've decided to import the data and clean it, then using a query to combine the two tables (input data and cleaned data) based on index. The problem is that I need to join inputdata.* and cleandata.* in a query (because I don't know what arbitrary fields will be in the inputdata table), but I want to exclude those fields that have been cleaned into the cleandata table.

So is there a way to write a query of select table.* EXCEPT CERTAIN FIELDS?

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top