Link to home
Start Free TrialLog in
Avatar of pdvsa
pdvsaFlag for United States of America

asked on

Saved Import - assign to a button

Experts, how can I call up a saved import through an event on a forms button?

I have to do this manually and want to assign this saved task to a button.  

thank you
Avatar of PatHartman
PatHartman
Flag of United States of America image

In the click event of the button, add the DoCmd.Transfer????, reference your saved import spec.
use this command

DoCmd.RunSavedImportExport "Name Of SavedImportExport"
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Although it seems that the RunSavedImportExport method is easier, keep in mind that you have no way to change it at run time.  So for example, if you are doing an export and you want to include the date as part of the file name, you can't do that with RunSavedImportExport.  You have to use the Transfer... method so you can include a different file name each time you export.

Also, the RunSavedImportExport is more fragile.  I just changed the code one of my clients wrote to use the TransferText because he doesn't have any control over the file he is receiving and the maker added two new columns.  The TransferText method (if you are importing a .csv file) doesn't fail.
Avatar of pdvsa

ASKER

Thank you.  Sorry for my tardy reply....