Code to archive old files

  • Thread starter Thread starter schaapiee
  • Start date Start date
S

schaapiee

Here is the concept:
I have reports that are run daily, monthly, etc..
I have a table which tells my webpage how many reports to show..aka
13; (for monthly this would show 13 months worth for that specific
report)
My files are appended with date information in the format of YYYYMM or
YYYYMMDD respectively.

I want to create an access application which can:
1. Reference an access table which says how many of each report should
be in the the specific directory.
ie. report1 = 12, report2 = 1, report3 = 35, report4 = 25, etc..
2. Look into that specific directory where the reports are stored.
3. Move the files in excess of the specified amount into an archive
folder located in same directory.

Can I write a date function which says get current date less table
value, then move remaining in folder x to folder y

Let me know if you need more information..
Thanks
Devon
 
schaapiee said:
Here is the concept:
I have reports that are run daily, monthly, etc..
I have a table which tells my webpage how many reports to show..aka
13; (for monthly this would show 13 months worth for that specific
report)
My files are appended with date information in the format of YYYYMM or
YYYYMMDD respectively.

I want to create an access application which can:
1. Reference an access table which says how many of each report should
be in the the specific directory.
ie. report1 = 12, report2 = 1, report3 = 35, report4 = 25, etc..
2. Look into that specific directory where the reports are stored.
3. Move the files in excess of the specified amount into an archive
folder located in same directory.

Can I write a date function which says get current date less table
value, then move remaining in folder x to folder y

Let me know if you need more information..
Thanks
Devon

How large is your file. Current versions of access support files up to
2 gig. If you are not coming close to that I suggest that you don't move
any of the data.

It appears you already have an archive using that date allowing you to
select only the current data. Usually it is suggested to add a new yes/no
field and call it archive, but if your data and dates are good, then you
don't even need to do that.

Now I do recommend you have and maintain a regular backup system where
you same a copy of your working file on regular bases. That should be done
more often than you would likely archive data however.
 
Im sorry I wasnt clear.
I am working with windows folders, and either .xls or .pdf files
within them ("the reports")
I am wanting to write vb code which will look at folder 1, read
through a local database to match the file desc[BaseFileName -below]
and move the files to folder 2(empty archive) if the count is greater
than that number[NumberOfHistorical -below].

Example Files in the Windows folder1:

AnalysisByOfficer_13_200601.PDF
AnalysisByOfficer_13_200602.PDF up through current month.
\
\
Example local access table data:

BaseFileName AnalysisByOfficer
InstitutionPrefixCharacter _
AppendInstitution true, this is the 13
AppendDate true
DateFormat _YYYYMM
FileNameExtension PDF
NumberOfHistorical 12

Let me know if I can make this more clear. Thanks again for any help!
 
schaapiee said:
Im sorry I wasnt clear.
I am working with windows folders, and either .xls or .pdf files
within them ("the reports")
I am wanting to write vb code which will look at folder 1, read
through a local database to match the file desc[BaseFileName -below]
and move the files to folder 2(empty archive) if the count is greater
than that number[NumberOfHistorical -below].

Example Files in the Windows folder1:

AnalysisByOfficer_13_200601.PDF
AnalysisByOfficer_13_200602.PDF up through current month.
\
\
Example local access table data:

BaseFileName AnalysisByOfficer
InstitutionPrefixCharacter _
AppendInstitution true, this is the 13
AppendDate true
DateFormat _YYYYMM
FileNameExtension PDF
NumberOfHistorical 12

Let me know if I can make this more clear. Thanks again for any help!

In that case, I can't be of much help My VB and VBA is minimal and
limited to that which I needed to work out my own problems before I retired.

Good Luck. I suspect someone with more knowledge in that area can give
you some guidance.
 

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

Back
Top