Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 207
  • Last Modified:

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
0
pdvsa
Asked:
pdvsa
  • 2
  • 2
1 Solution
 
PatHartmanCommented:
In the click event of the button, add the DoCmd.Transfer????, reference your saved import spec.
0
 
Rey Obrero (Capricorn1)Commented:
use this command

DoCmd.RunSavedImportExport "Name Of SavedImportExport"
0
 
Rey Obrero (Capricorn1)Commented:
private sub button1_click()

DoCmd.RunSavedImportExport "Name Of SavedImportExport"

end sub
0
 
PatHartmanCommented:
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.
0
 
pdvsaProject financeAuthor Commented:
Thank you.  Sorry for my tardy reply....
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now