473,466 Members | 1,379 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Import from File Open Dialog

Jim
I am trying to import a file using a file spec from the Access File
Open dialog... I have been out to
http://www.mvps.org/access/api/api0001.htm to look at the code, but
because I'm not a guru, I don't quite understand it all. I have gotten
as far as getting the File Open dialog to appear and then tell me what
file I chose, but if someone could help me understand how to take that
file I've selected and import it using my specification, I'd appreciate
it.

Nov 13 '05 #1
2 5807
Jim wrote:
I am trying to import a file using a file spec from the Access File
Open dialog... I have been out to
http://www.mvps.org/access/api/api0001.htm to look at the code, but
because I'm not a guru, I don't quite understand it all. I have gotten
as far as getting the File Open dialog to appear and then tell me what
file I chose, but if someone could help me understand how to take that
file I've selected and import it using my specification, I'd appreciate
it.


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Using the following code:

Dim strFilter As String
Dim strInputFileName As String

strFilter = ahtAddFilterItem(strFilter, _
"Text Files (*.txt;*.asc;*tab;*.csv)", _
"*.txt|*.asc|*.tab|*.csv")
strInputFileName = ahtCommonFileOpenSave(Filter:=strFilter, _

OpenFile:=True, _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_HIDEREADONLY)

The file name is in the variable strInputFileName. Then use the
variable like this:

DoCmd.TransferText acImportDelimited, "SpecName", "tableName",_
strInputFileName

See the Access VBA Help article "TransferText Method" for more
information.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQnaCWoechKqOuFEgEQIFewCeOEt8OOc0VEkan4A6nr682M 0JDHcAni8o
SmFP2jlSOajrCyzMdmGSAYOF
=CJY4
-----END PGP SIGNATURE-----
Nov 13 '05 #2
Jim
Thanks! Works great!

Nov 13 '05 #3

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

Similar topics

3
by: *no spam* | last post by:
I want to move my Access 2K database into MSDE. The Access Upsizing Wizard crashes (a known bug wi A2K), so I'm using the following suggested method: Access --> New --> Project (Existing...
1
by: Fred | last post by:
Hi. How do I import while mapping an excel table to an access table please??? I've searched around and all I can find is a software product or code that does the same thing as the access...
1
by: wolff1215 | last post by:
I have a CSV file that is downloaded twice a day. The file comes zipped (And they won't change it for me) Is it possible to open the Zipfile and a import the file contained with in it? (I'll...
2
by: Mattbooty | last post by:
Hello, Not sure if anyone else has seen this bug, but I have a form where the entire form is covered with a picturebox. The picturebox has a mouseup event. I also have an open file dialog for...
2
by: Radu | last post by:
Hi. I got a "|" delimited file, and one of its columns (the last one) is MANY chars long. If I use my try to manually import the file, the text in the last column is cut off at char 255, as it...
3
by: derfer | last post by:
I am trying to import a .inf file into access (the file comes from the output of some 3rd party software). I have managed to convert the file by opeing it in notepad and re-saving then a seperate...
3
by: ArmageddonAsh | last post by:
I'm trying to make an application that will allow the user to enter data into a flexgrid (that's done) and then save the data from that flexgrid into a CSV file but even though the file is made none...
4
by: David | last post by:
Hi I'm using this code to import data from an excel spreadsheet: DoCmd.TransferSpreadsheet , acSpreadsheetTypeExcel9, "tblStudents", _ "\\Egusersrv\Staff - Shared Work\PE Teach &...
6
by: provor | last post by:
Hello, I have the following code that I am using when a user presses a button to import an excel file into a table. The code is hard coded to point to the correct table. This works great for this...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
1
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...
0
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...
0
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,...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.