Extract date from filename

Hi again, I followed your suggestions and replace GoTo GotIt with Exit While, but I still got a comile error - syntax errror. Is there something else I should be looking for?
 
Not sure, but it is about time to see if you can post the db or email it. I think that would get things solved much faster at this point.
 
well i didnt put a label called gotit in my code snippet
so after the wend you need a label (with a colon)

ie
gotit:

and carry on from there

----------
bob, yor are probably right about using do loop construct

i learned pascal originally and there was only

while {condition} - test at top
begin
{statements}
end

repeat
until {condition} - test at end - therefore runs loop at least once

---------
i guess you stay with what you are used to ..


-----------
but there was

as well as for x=1 to 10
you could have for x="A" to "Z"

and you could use set constructs, so you could have
if x in ("A" .. "D"), in code

I miss them!
 
OK, I had made changes, but still don't get the correct results. I have attacted the Excel file with the file name that ends with 4_13_2008.xls and the database. On the button click, it should only read the last section with the date and convert it to 4/13/2008 and put that in the CallDate field in the database. Thanks again for all your help.
 

Attachments

ABC_BNG_GTR_04012008.XLS
ABC_BNG_GTR_04_01_2008.XLS

you have quoted file names as in both the above

-- my code scans the file name to find the first numeric char, and then val returns the number, assigned to a string

in the first case it returns 04012008
in the second it wil lreturn just 04

it will also fail if there is a number in the folder path.

---
you have to be precise in what you are trying to do, and structure the code accordingly. Its much harder with underscores.

if the date is fully specified (ie 03_06_2008 - includes 0's were necessary) and always the last 10 charaters before the file extension you can strip it that way instead.

But you need a standard to work to.
 

Users who are viewing this thread

Back
Top Bottom