Write names of folders to table once added to directory?

chris-uk-lad

Registered User.
Local time
Today, 15:06
Joined
Jul 8, 2008
Messages
271
Hi all!

Basically, i need a method for when a user is going to scan an image, then places it in a folder, allowing that folders name added to a table automatically once saved. Because independent from the scanning program (Imaging - Kodak) i need to find a way to run the code to update the table automatically once an image is scanned, and i dont really understand batch files :x

Any suggestions on how to run this? i did think of linking the scanning softwares shortcut to the tool first then shell the scanning program but then i wouldnt be able to update the table.

Many Thanks
 
Have a read in the Access help on the Dir command and Recordsets...

Post back what problems you encounter.

Regards
 
if your pointing towards creating a recordset of the subfolders in that folder then writing to the table(an index) where they are different, that would work but would cause a problem in both processing time as the directory grew and instancing the code to begin (want to avoid a user opening the tool after creating a directory and running in order to update)
 
You're able to read the properties of any file system object and you can time-stamp the records that you add to your table so you can get it to poll the folder structure only for those items created since last update.
 
You're able to read the properties of any file system object and you can time-stamp the records that you add to your table so you can get it to poll the folder structure only for those items created since last update.

i see what your saying with this and wasnt even aware of being able to access properties in a recordset so thanks :)

however, is there a way to run this in an automated way? thats my main problem, running the code without the user touching the tool itself
 
Someone/something must run the database, or it must be open 24/7 ...

You can use the windows schuduler to run the database if you like... if that is what you mean....
 
If your database is opened daily, just have the code run on firing a particular event, rather than on start-up, such as the form accessed before the one that will need to display the updated information.

If it's only opened weekly, there's even less urgency. Either way, firing the code automatically when your database is open should suffice over attempting to schedule it.
 
just thinking into things (the scheduler isnt an option because i will be running this on several machines). Is there a way to have a batch run the code once the user logs in? again im unfamiliar with batch files
 
Last edited:
Logs into the computer or into the database? If the latter, a batch file isn't necessary; just create a macro in the database called autoexec() and it will run when the database is opened. This is the easier option.

If the former then yes. You create the batch file and save it somewhere generic. Then you create a Scheduled Task in Control Panel which calls the batch file according to a schedule, one of the options for which is On Login. I usually use these to make sure that users have their mapped drives setup correctly.

If you go the second route, the same Scheduled Task can hold multiple schedules, so you could also get it to fire say every couple of hours. If your code was embedded in a different database, on a server, with tables linked to the main database, users wouldn't even see a performance drop.
 
Last edited:
Yes, you can use the scheduler (Control panel > Scheduled tasks) to start any application any time... though running it in a scheduler will require the PC to be on.

Perhaps a good idea would be to run a batch file on some server instead that creates text files for your DB to load/analyse??
 
currently looking into batch files or a vbs to be run from scheduler, though having errors with vbs (not yet tried batch):

vbs:
dim accessApp
set accessApp = createObject("Access.Application")
accessApp.OpenCurrentDataBase("C:\Images.mdb")
accessApp.Run "NewImages"
accessApp.Quit
set accessApp = nothing

This produces an error saying NewImages cannot be found, NewImages is a module within the database.

I know your access experts and not sure if know about these things, but may have encountered them before so fingers crossed someone can help.
 
A quick look at your code and the MS Access help file suggests to me that you can't call a module; you need to call a function or subroutine within it, just as you would in MS Access.

The example given is coded like this:
Code:
Dim appAccess As New Access.Application
appAccess.OpenCurrentDatabase ("C:\My Documents\WizCode.mdb")
appAccess.Run "WizCode.NewForm", "Some String"
Hoping this helps
 
Why do it difficult and run Access from VBS?
Simple commandline is so much easier... can even trigger a macro to be run at startup (other than autoexec), read the access help for all the switches you can use.
 
im not trying to make it difficult, im just looking at methods as i find them as i dont really know anything at the moment about this sort of thing.

might you have another source for the switchs? im having trouble getting my head around the access help information
 

Users who are viewing this thread

Back
Top Bottom