Importing what file name?

B

Bonnie A

Hi everyone! Happy holidays to you and yours! Thank you very much for being
such wonderful elfs all year long helping those of us who are nice to get our
toys to work right.

I have 2 macros, one that imports a .txt file and one that imports a .csv
file. The file name in the .csv TransferText Action is this:

="S:\RPS\PTS\CensusConversion\" & [Forms]![fCensus1Conversion]![PolNum] &
".csv"

and the .txt TransferText Action is this:

="S:\RPS\PTS\CensusConversion\" & [Forms]![fCensus1Conversion]![PolNum] &
".txt"

Right now, a system download creates a file that is named the policy number
([PolNum]) in either text or comma delimited format. For example 4432.txt or
4432.csv.

The new system download is going to tag on the date and time of creation so
the new file example is: 2571_120081217_152746.csv or
2571_120081217_152746.txt.

I tried to insert an asterisk for 'like' but I'm missing something. How can
I set the language to find the file that 'starts' with the policy number?

Thank you in advance for your time and assistance!
 
D

Douglas J. Steele

Not quite sure the purpose of the 1 in the file name before the date, but
try:

="S:\RPS\PTS\CensusConversion\" & [Forms]![fCensus1Conversion]![PolNum] &
"_1" & Format(Now, "yyyymmdd\_hhnnss:") & ".csv"
 
B

Bonnie A

Hi Mr. Steele,

I don't know why there is a 1_ before the date either. It's some sort of new
auto naming when they download from Relius.

I need to know how to word my expressions to allow for the four digit
contract number "*" (and whatever appears afterwards) and then ending with
..txt or .csv. For example; 4237 & "*" &".txt".

Hope I've explained it better. Sorry for not being more specific.

I can't use Now() because we may not upload it the same day. Plus, how did
yours allow for the variable digits after the contract number and the date?
The example files I used were 2571_120081217_152746.csv and
2571_120081217_152746.txt. I have no idea what the _152746 is for either nor
do I know if it will change. That is why I need to allow for a wildcard
after the four digits.

--
Bonnie W. Anderson
Cincinnati, OH


Douglas J. Steele said:
Not quite sure the purpose of the 1 in the file name before the date, but
try:

="S:\RPS\PTS\CensusConversion\" & [Forms]![fCensus1Conversion]![PolNum] &
"_1" & Format(Now, "yyyymmdd\_hhnnss:") & ".csv"



--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Bonnie A said:
Hi everyone! Happy holidays to you and yours! Thank you very much for
being
such wonderful elfs all year long helping those of us who are nice to get
our
toys to work right.

I have 2 macros, one that imports a .txt file and one that imports a .csv
file. The file name in the .csv TransferText Action is this:

="S:\RPS\PTS\CensusConversion\" & [Forms]![fCensus1Conversion]![PolNum] &
".csv"

and the .txt TransferText Action is this:

="S:\RPS\PTS\CensusConversion\" & [Forms]![fCensus1Conversion]![PolNum] &
".txt"

Right now, a system download creates a file that is named the policy
number
([PolNum]) in either text or comma delimited format. For example 4432.txt
or
4432.csv.

The new system download is going to tag on the date and time of creation
so
the new file example is: 2571_120081217_152746.csv or
2571_120081217_152746.txt.

I tried to insert an asterisk for 'like' but I'm missing something. How
can
I set the language to find the file that 'starts' with the policy number?

Thank you in advance for your time and assistance!
 
D

Douglas J. Steele

Sorry, I completely misunderstood your question. I thought you wanted to be
able to create a file name (I assumed 152746 was the time)

I think you'll have to use VBA, not macros. If you use the Dir function with
a partial file name, you'll be able to get all matching files in that
folder.

Dim strFolder As String
Dim strFile As String

strFolder = "S:\RPS\PTS\CensusConversion\"
strFile = Dir(strFolder & [Forms]![fCensus1Conversion]![PolNum] &
"_1*.txt")
Do While Len(strFile) > 0
' At this point, strFolder & strFile is a matching file
strFile = Dir()
Loop

That loop will coninue for as many files match.



--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Bonnie A said:
Hi Mr. Steele,

I don't know why there is a 1_ before the date either. It's some sort of
new
auto naming when they download from Relius.

I need to know how to word my expressions to allow for the four digit
contract number "*" (and whatever appears afterwards) and then ending with
.txt or .csv. For example; 4237 & "*" &".txt".

Hope I've explained it better. Sorry for not being more specific.

I can't use Now() because we may not upload it the same day. Plus, how
did
yours allow for the variable digits after the contract number and the
date?
The example files I used were 2571_120081217_152746.csv and
2571_120081217_152746.txt. I have no idea what the _152746 is for either
nor
do I know if it will change. That is why I need to allow for a wildcard
after the four digits.

--
Bonnie W. Anderson
Cincinnati, OH


Douglas J. Steele said:
Not quite sure the purpose of the 1 in the file name before the date, but
try:

="S:\RPS\PTS\CensusConversion\" & [Forms]![fCensus1Conversion]![PolNum] &
"_1" & Format(Now, "yyyymmdd\_hhnnss:") & ".csv"



--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Bonnie A said:
Hi everyone! Happy holidays to you and yours! Thank you very much for
being
such wonderful elfs all year long helping those of us who are nice to
get
our
toys to work right.

I have 2 macros, one that imports a .txt file and one that imports a
.csv
file. The file name in the .csv TransferText Action is this:

="S:\RPS\PTS\CensusConversion\" & [Forms]![fCensus1Conversion]![PolNum]
&
".csv"

and the .txt TransferText Action is this:

="S:\RPS\PTS\CensusConversion\" & [Forms]![fCensus1Conversion]![PolNum]
&
".txt"

Right now, a system download creates a file that is named the policy
number
([PolNum]) in either text or comma delimited format. For example
4432.txt
or
4432.csv.

The new system download is going to tag on the date and time of
creation
so
the new file example is: 2571_120081217_152746.csv or
2571_120081217_152746.txt.

I tried to insert an asterisk for 'like' but I'm missing something.
How
can
I set the language to find the file that 'starts' with the policy
number?

Thank you in advance for your time and assistance!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top