473,804 Members | 3,312 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can I use wildcards in TransferText import?

I need to import a text file pretty much daily. I download the file
and change the name to a standard name and then run the code to import
the file into a table in my database. The problem is that the file
starts with a standard name but adds the date and some other stuff to
the end of the file name. Is there a way I could use a wildcard like
"*" so I wouldn't have to change the name?

Thanks for any help
Nov 13 '05 #1
11 9182
No, you cannot -- when the filesystem opens a file it needs a legal name.
But you can write code to get the name that uses wildcards via the Dir()
function, and then use the name you get....
--
MichKa [MS]
NLS Collation/Locale/Keyboard Development
Globalization Infrastructure and Font Technologies

This posting is provided "AS IS" with
no warranties, and confers no rights.
"Shyguy" <sh****@aol.com > wrote in message
news:o4******** *************** *********@4ax.c om...
I need to import a text file pretty much daily. I download the file
and change the name to a standard name and then run the code to import
the file into a table in my database. The problem is that the file
starts with a standard name but adds the date and some other stuff to
the end of the file name. Is there a way I could use a wildcard like
"*" so I wouldn't have to change the name?

Thanks for any help

Nov 13 '05 #2
I'm not sure I follow. The original filename doesn't use wildcards.
it just has different endings. Are you saying I can write code to
change the file name into a specific name?

On Thu, 10 Jun 2004 20:10:42 -0700, "Michael \(michka\) Kaplan [MS]"
<mi*****@online .microsoft.com> wrote:
No, you cannot -- when the filesystem opens a file it needs a legal name.
But you can write code to get the name that uses wildcards via the Dir()
function, and then use the name you get....


Nov 13 '05 #3
You can write code to

(1) detect the filename (using wildcards)
(2) use that detected filename in your call to TransferText
--
MichKa [MS]
NLS Collation/Locale/Keyboard Development
Globalization Infrastructure and Font Technologies

This posting is provided "AS IS" with
no warranties, and confers no rights.
"Shyguy" <sh****@aol.com > wrote in message
news:46******** *************** *********@4ax.c om...
I'm not sure I follow. The original filename doesn't use wildcards.
it just has different endings. Are you saying I can write code to
change the file name into a specific name?

On Thu, 10 Jun 2004 20:10:42 -0700, "Michael \(michka\) Kaplan [MS]"
<mi*****@online .microsoft.com> wrote:
No, you cannot -- when the filesystem opens a file it needs a legal name.
But you can write code to get the name that uses wildcards via the Dir()
function, and then use the name you get....

Nov 13 '05 #4
Thanks for your reply and patience. Being pretty much a beginner at
this, I really have no clue as the where to start this. Could you
direct me to sample code, or a starting place to search?

Thanks again
On Fri, 11 Jun 2004 10:00:18 -0700, "Michael \(michka\) Kaplan [MS]"
<mi*****@online .microsoft.com> wrote:
You can write code to

(1) detect the filename (using wildcards)
(2) use that detected filename in your call to TransferText


Nov 13 '05 #5
As I said, the Dir() function is your friend. You can say (in VBA):

Dim stFile As String

stFile = Dir$("C:\FOO\BA R\FILE??.TXT")

and stFile will contain the first file in C:\FOO\BAR\ that matches the
pattern given.

From there you can call the TransferText method, passing stFile in as the
filename. For more info, look in the online help on the Dir$ function and
the TransferText method.
--
MichKa [MS]
NLS Collation/Locale/Keyboard Development
Globalization Infrastructure and Font Technologies

This posting is provided "AS IS" with
no warranties, and confers no rights.
"Shyguy" <sh****@aol.com > wrote in message
news:r3******** *************** *********@4ax.c om...
Thanks for your reply and patience. Being pretty much a beginner at
this, I really have no clue as the where to start this. Could you
direct me to sample code, or a starting place to search?

Thanks again
On Fri, 11 Jun 2004 10:00:18 -0700, "Michael \(michka\) Kaplan [MS]"
<mi*****@online .microsoft.com> wrote:
You can write code to

(1) detect the filename (using wildcards)
(2) use that detected filename in your call to TransferText

Nov 13 '05 #6
Thank you so much for all the help. Unfortunately I still can't get
it to work. These are the two main lines of code.

stFile = Dir$("C:\Docume nts and Settings\Me\Des ktop\Testing*.t xt")

DoCmd.TransferT ext acImportDelim, "", "TestTable" , stFile, True, ""

If I substitute stFile with the actual name of the file everything
works fine.

When I run it with the stFile, I get an error message saying that it
can't find the file, but it shows the correct file name in the error
message.
On Fri, 11 Jun 2004 21:57:14 -0700, "Michael \(michka\) Kaplan [MS]"
<mi*****@online .microsoft.com> wrote:
Dim stFile As String

stFile = Dir$("C:\FOO\BA R\FILE??.TXT")


Nov 13 '05 #7
All the Dir function returns is the name of the file without its folder. You
need to add the folder yourself.

stFile = Dir$("C:\Docume nts and Settings\Me\Des ktop\Testing*.t xt")

DoCmd.TransferT ext acImportDelim, "", "TestTable" , "C:\Documen ts and
Settings\Me\Des ktop\" & stFile, True, ""
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"Shyguy" <sh****@aol.com > wrote in message
news:i3******** *************** *********@4ax.c om...
Thank you so much for all the help. Unfortunately I still can't get
it to work. These are the two main lines of code.

stFile = Dir$("C:\Docume nts and Settings\Me\Des ktop\Testing*.t xt")

DoCmd.TransferT ext acImportDelim, "", "TestTable" , stFile, True, ""

If I substitute stFile with the actual name of the file everything
works fine.

When I run it with the stFile, I get an error message saying that it
can't find the file, but it shows the correct file name in the error
message.
On Fri, 11 Jun 2004 21:57:14 -0700, "Michael \(michka\) Kaplan [MS]"
<mi*****@online .microsoft.com> wrote:
Dim stFile As String

stFile = Dir$("C:\FOO\BA R\FILE??.TXT")

Nov 13 '05 #8
Thank you, thank you, thank you. I thought that since the Dir$ was =
to the directory and file name that stFile would be = to the same.
Obviously I don't understand Dir$. ;-(

Although I do understand it a little better now.

Thanks again.

On Sat, 12 Jun 2004 11:53:25 GMT, "Douglas J. Steele"
<NOSPAM_djsteel e@NOSPAM_canada .com> wrote:
DoCmd.Transfer Text acImportDelim, "", "TestTable" , "C:\Documen ts and
Settings\Me\De sktop\" & stFile, True, ""


Nov 13 '05 #9
I ran into a slight snag. The files come in with 2 periods in
different places within the filename. Is there a way to remove the
periods with code?

On Sat, 12 Jun 2004 11:53:25 GMT, "Douglas J. Steele"
<NOSPAM_djsteel e@NOSPAM_canada .com> wrote:
All the Dir function returns is the name of the file without its folder. You
need to add the folder yourself.

stFile = Dir$("C:\Docume nts and Settings\Me\Des ktop\Testing*.t xt")

DoCmd.TransferT ext acImportDelim, "", "TestTable" , "C:\Documen ts and
Settings\Me\De sktop\" & stFile, True, ""


Nov 13 '05 #10

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

Similar topics

2
1962
by: ms | last post by:
In Access 2000, I am using... 'Import Raw text to stageBMIDLog table. DoCmd.TransferText acImportFixed, "BMIDLog Link Specification", "stageBMIDLog", file ....to import raw records into a staging table with 3-key PK. When duplicates are attempting import, I receive a msgbox stating the number of records that violated the PK and asks if I want to continue.
6
3054
by: Vladislav Moltchanov | last post by:
I have discovered a couple of years ago, that import with DoCMD.TransferText for CSV text file doesn’t work in Acc2000, while it works perfectly in ACC97. which has been discussed on this newsgroup forum, so this fact was fixed. Since I have to transfer files from VMS( SAS ) to WIN (Access), I still keep using ACC97 as a simplest and reliable tool. However, final products, such as distributable data entry system for multi central...
4
9480
by: khutch | last post by:
Not that up on MS Access. I understand that the TransferText command can be used to import csv files into a database. Question: Does the text file have to mirror the alignment of the table columns e.g. must field1, field2, filed3 etc correspond to col1, col2, col3 on the table? or can I state somewhere which columns in the text file correspond to which table columns. I actually need col1, col2, col5 and col6 from the text file to populate...
3
545
by: Jack Doman | last post by:
Does anyone know how I can use Access XP's TransferText method to import a tab delimited text file? It works fine for comma delimited files. *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
3
4372
by: Typehigh | last post by:
I am a pretty saavy user, but I am having a real problem with the DoCmd.TransferText operation. I manually used the File>Get External Data> Import routine to set up an import specification. It works like a champ everytime it's run. If I use VBA to execute a TransferText and specify the specfile, I get a Type Conversion Error on import and a table full of empty records (equal to the number of lines in my import data file). My data...
3
12710
by: holdemfoldem | last post by:
Hi. I'm new to this board and have a few questions about using the method referred to in the topic of this message. I have manually transferred over 1/2 million records from a text file into my Access table in under 1 minute, using File>Get External Data>Import, then specifying .txt as the data source, selecting the text file, and walking through the resulting Wizard. I'm thinking I can do the same thing with DoCmd.TransferText, but...
3
9426
by: Oliver Gabriel | last post by:
Hi, i want to export a table for later import, using vba. That´s my code: export: filename = "C:\HVOtabelle.txt"
0
1417
by: matchine | last post by:
This is a recommendation based on my research on an issue with the transfer text functionality. The comments below were from a tech I approched for help. "The transfer text process blocked after importing 6139 records each time on my side. After further research, there maybe a memory leak in TransferText. When the number of records exceeds its limitation, the transfer process blocked. Therefore, please abandon TransferText and write...
0
2032
by: Sean Howard | last post by:
I have a strange problem linking tab delimited text files in Access 2000 (I am running Windows XP), please try this and let me know if I am going mad. Step 1. Create the tab-delimited text file below in WordPad and call the file "HeaderYES.txt" (the space between the two fields is actually a tab):- "Column1" "Column2" 1 "Line1"
0
9705
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10564
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10320
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10073
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
9134
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
7609
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
5513
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
4288
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
2
3806
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.