473,804 Members | 2,261 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Automating a command button to do a Get External Data command

I'm trying to use a command button to the same thing as going to the
file menu and doing a Get External Data command to make the import
process easier for some end users. I'm using Access 2k, I have the
following code but I can't seem to get it to work properly.

Private Sub Command18_Click ()
Dim strFileName As String
Dim strPath As String

strPath = "C:\ data" 'the location of the files
strFileName = "report.csv "

DoCmd.TransferT ext acImportDelim, "Data", strPath &
strFileName, "PC_Date", False
End Sub

Is there someone that can tell me what I'm missing or what I have
wrong.
Thanks

Dec 9 '05 #1
3 2505
Br
Bill wrote:
I'm trying to use a command button to the same thing as going to the
file menu and doing a Get External Data command to make the import
process easier for some end users. I'm using Access 2k, I have the
following code but I can't seem to get it to work properly.

Private Sub Command18_Click ()
Dim strFileName As String
Dim strPath As String

strPath = "C:\ data" 'the location of the files
strFileName = "report.csv "

DoCmd.TransferT ext acImportDelim, "Data", strPath &
strFileName, "PC_Date", False
End Sub

Is there someone that can tell me what I'm missing or what I have
wrong.
Thanks
First, did you check the Access help? I've included a snippet from it
below.

It is hard to diagnose the problem when you don't tell us what happens
when you run the code? Nor do we get a clear indication of what "data"
and "PC_Date" are?

---------- From the Access Help

Syntax:

DoCmd.TransferT ext [transfertype][, specificationna me], tablename,
filename[, hasfieldnames][, HTMLtablename][, codepage]

Remarks
You can leave an optional argument blank in the middle of the syntax,
but you must include the argument's comma. If you leave a trailing
argument blank, don't use a comma following the last argument you
specify.

----------
DoCmd.TransferT ext acImportDelim, "Data", strPath &
strFileName, "PC_Date", False


According to the syntax desscription your code reads:

Transfertype = acImportDelim (ok)
SpecificationNa me = "Data"
Tablename = strPath & strFileName
Filename = "PC_Date"
HasFieldNames = False

Don't forget to include commas for all the options even if you are
leaving them blank (except ones that are at the end of the line).

eg. No value given for specification, HTMLtablename, or Codepage

Docmd.TransferT ext acImportDelim, ,"tblMyTable ", "c:\myfile.txt" , False
--
regards,

Bradley

A Christian Response
http://www.pastornet.net.au/response
Dec 9 '05 #2
I have the command working now but because some of the headers have a
"." in the name its seeing the period as a delimiting character.
Because this is happening it's not finding the corresponding fields in
the table. Is there a way of telling it to only look for commas ","
to separate the data??

Dec 9 '05 #3
I was wrong. What is really happening is that the "." showing up as a
"#" and that is the reason that I can't get it to compleatly inport the
data. Any Ideas as to why that might be happening and how to fix the
problem??

Dec 9 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1280
by: Chanus | last post by:
I'm trying to automate a series of commands in ACCESS to import a data file in XML format. Normal procedure: -Start "MS Access" -Click "File->Get External Data->Import" -Choose the appropriate "xml" file. -Select "Options" and click "Append Data to Existing Table(s). Currently I have a Visual C++ GUI program to organize the data and
4
3158
by: James Johnson | last post by:
Dear C#Dex, I am trying to automate a POST to a web page that clicks a button. I have been able to hit a target web page and run the web page. However, the button on the page does not click. I can set the target web page to change to a new URL when I hit it, and that works, but I cannot get the button to click based on my POST command. Is there some secret to clicking the button? I have a button named btnGo and I set the value of...
9
2793
by: Neo Geshel | last post by:
I have strip-mined, strip-searched, and completely exhausted the Internet (up to the 30th page on Google, with 100 results per page!!), all without finding an answer to my question AS TO WHY IT IS IMPOSSIBLE TO PROGRAMMATICALLY ADD A BUTTON TO A DYNAMICALLY CREATED PAGE. Or, to be more precise, why it is impossible to have an onClick sub respond to that button’s Click event. My main page has only one line:
1
17959
by: chris_j_adams | last post by:
Hi, I'm trying to use Excel VBA ('97) to send details from an Excel sheet to a web page. I'm having some success but I've one issue that's proved difficult to find in the archives. There are a number of elements (ie. text boxes) on this web page that are conditionally "greyed out". They should become visible (ie. not greyed) when a prior element is entered with data. However, this is not happening. The elements are being filled,...
7
7862
by: support | last post by:
Hi, I am trying to change the text of a Command button using the Windows API Function SetWindowText, which I have declared as follows: <DllImport("User32")_ Public Function SetWindowText(ByVal hWnd As IntPtr, ByVal lpString As String) As Boolean End Function
3
10329
by: jlw16 | last post by:
Hello, I’m trying to use my vbs script to get a command line argument for a file which will need to be opened through QuickTestPro. Below are the commands I’m using: Dim qt_file 'As String -> If I don’t comment out the As String, I get an “Expected end of statement” error – is this correct?? qt_file = Command -> This doesn’t appear to be correct – when I echo out qt_file it’s null qtApp.Test.DataTable.Import qt_file ' Import data...
4
3208
by: attachmatey | last post by:
Greetings: I'm looking for some help in automating (what I thought would be) a simple procedure in Internet Explorer. I'm trying to put the following operation under a button click in an MS Access database form: 1. Navigate to URL and click button 2. Enter user name and password 3. Apply filters (enter criteria in text boxes) 4. Execute query (another button click) 5. Export results to network server 6. Data mining using Monarch...
7
4778
JodiPhillips
by: JodiPhillips | last post by:
Hi, My first post! I've basically taught myself Access and the little I know about VBA through reading these forums and a couple of books. I'm in the middle of a project at work - to put it mildly I've been thrown in at the deep end, in the past I've just done simple databases and that's been fine. Now, however I have to "roll out" various front ends to a single back end for initially 10 users (and the bosses have plans for this to go to...
2
4430
by: iamdennis | last post by:
Hi all. I stuck here and need some help. I have created a combo box which contains a list of links to external PDF files. I also created a OPEN command button next to the combo box. I want to be able to select a file from the list and use the command button to open this external PDF file. I already know how to use just a command button to open an external file. However, it is very time consuming to use command buttons when you have...
0
9594
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10347
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10090
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9173
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7635
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6863
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5531
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4308
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.