Solved

Is there a way to use a command button to execute a Saved Import?

Posted on 2013-12-30
10
1,177 Views
Last Modified: 2013-12-30
I have two saved imports that I run once a month. Is there a way to enter these two saved  imports in a command button?
0
Comment
Question by:Conernesto
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 2
10 Comments
 
LVL 37

Expert Comment

by:PatHartman
ID: 39746891
Yes.  You would use one of the transfer methods.  TransferText, TransferSpreadsheet, ... depending on what type of file you are importing.  If it is a text file, you might have saved an import spec if you went to the Advanced tab.  In that case, you can include the name of the import spec in the TransferText method and that will use the same definition you saved.  Intellisense will help you with the arguments as you type.  We need more information to go further.
1. Type of File
2. Is there a file spec?  What is its name?
3. Do you have to search for the file or is it always the same name and location?
0
 

Author Comment

by:Conernesto
ID: 39746976
Let me know if the below does not answer the questions.

The path to one file is:
R:\GlobalSvcTax\Sales and Use Tax Compliance\Sales and Use Rates\ZipSales Data\FLATT.txt
The saved import name is:
Import-FLATT Rev

The path to the second file is:
R:\GlobalSvcTax\Sales and Use Tax Compliance\Sales and Use Rates\ZipSales Data\FLAT.txt
The saved import name is:
Import-FLAT Rev

The file is always in the same location
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39747021
yes you can using the command line below

private sub btn_click()

docmd.RunSavedImportExport (nameOfSavedImportOrExport)


end sub
0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
LVL 37

Expert Comment

by:PatHartman
ID: 39747027
    DoCmd.TransferText acImportFixed, "Import-FLATT Rev
", "table name", "R:\GlobalSvcTax\Sales and Use Tax Compliance\Sales and Use Rates\ZipSales Data\FLATT.txt", False

Open in new window

That may work but you'll need to replace "table name" with the actual table name.  I also made two assumptions that may need to change:
acImportFixed - the records are fixed format rather than delimited (acImportDelim)
False - there are no column headers.  Change this to True if the first row contains column headers.

As I said, intellisense is a wonderful tool and will guide you in typing code.
0
 

Author Comment

by:Conernesto
ID: 39747069
I am getting a compile error: Expected: end of statement. It appears to be going to the table name "MonthlyRateChanges". Below is what I entered for the command button.

Private Sub Command18_Click()

'This sub will import Import-FLATT Rev

    DoCmd.TransferText acImportFixed, "Import-FLATT Rev"", "MonthlyRateChanges", "R:\GlobalSvcTax\Sales and Use Tax Compliance\Sales and Use Rates\ZipSales Data\FLATT.txt", False
End Sub
0
 

Author Comment

by:Conernesto
ID: 39747072
How do I access the intellisense tool?
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39747078
@Conernesto


did you see my post at http:#a39747021 ?






.
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 39747087
try this


private sub btn_click()

DoCmd.RunSavedImportExport ("Import-FLATT Rev")

DoCmd.RunSavedImportExport ("Import-FLAT Rev")



end sub



.
0
 

Author Closing Comment

by:Conernesto
ID: 39747105
I was not able to see your post at http:#a39747021. Am I suppose to put this on the address bar?

The above code is great for importing my files!!

conernesto
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39747127
@Conernesto,

<I was not able to see your post at http:#a39747021 >

to go to the post you just need to click on the hyperlink, http:#a39747021  is hyperlink.
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question