Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

File Name problems.

17 views
Skip to first unread message

musicloverlch

unread,
Nov 9, 2009, 12:08:12 PM11/9/09
to
Please help. I have a program that automatically runs each morning to
pick up the latest fund information files from various companies. They
all work except one that puts a 4 digit time stamp of when the file
was ready to pick up at the company on the end of the file name.

I am calculating the filenames and they all look like this:

RKDate = Format(Date, "mmddyy") & "am" & ".xls"
ASTDate = "ab" & Format(Me.AsofDate, "mmddyy") & ".pos"

Trustlynx is the problem child. Their file is named something like
"STPDLPOSITION200911090414.POS".

The file name is pretty standard except that the last 4 numbers before
the .pos are a time stamp of when the file was ready at the custodian,
so it will be different and unknown every day.

How do I tell Access to pickup the file no matter what the last 4
digits are? I already tried this:

TrustLynxDate = "STPDLPOSITION" & Format(Date, "yyyymmdd") & "*.POS"

and it didn't like it.

Thanks in advance,
Laura

Rich P

unread,
Nov 9, 2009, 4:23:11 PM11/9/09
to
Hi Laura,

It is not completely claar what your problem is. It sounds like you are
saying that your problem is that a file is not being picked up because
it has some kind of time stamp.

Could you state if something is happening that you don't want to happen
yes/no? Or is something not happening that you want to happen yes/no?
Could you state what it is that is or is not happening that you need to
be different?

If the program is rejecting a file because it has some kind of timestamp
- do you have access to this program's code? Is the problem occuring at
the Access.mdb level or is the problem occuring before Access?

Rich

*** Sent via Developersdex http://www.developersdex.com ***

Salad

unread,
Nov 9, 2009, 4:35:41 PM11/9/09
to

Let's say you have a file XYZ.Txt in the C: drive
Dim strFile as String
strFile = Dir("C:\XYZ.Txt")
strFile will be XYZ.Txt.

If you entered
strFile = Dir("C:\XYZ1.Txt")
and there was no file, strFile would be equal to ""

Let's assume that you have an XYZ1.Txt file and you expect at least the
filename to begin with XYZ
Dir("C:\XYZ*.Txt)
then strFile would be equal to C:\XYZ1.Txt if there was no other file
beginning with XYZ (it coule be XYZ.Txt or XYZ0.Txt for example).

Is there a way for you to separate the filename from the extension,
maybe calc the anticipated name and format, and check for the existence?
If found, then process?

0 new messages