Moving Files and automatically

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, I am in need of some help with a database I am trying to design.

I am trying to move a file "1.bmp" from a folder to a different folder,
automatically rename it, pass the file location back to an "image" table and
then move the next file "2.bmp" until all files are moved. I need to
autoname, because I will have to do this over and over starting with "1.bmp"

Any tips would be helpful.

Thanks
 
60thjeep,

You haven't given us much to go on, but maybe something along these (air
code!) lines will help give you a clue...

Dim FileFrom As String
Dim FileTo As String
Dim i As Integer
i = 1
FileFrom = Dir("C:\FromPath\*.bmp")
Do Until Len(FileFrom) = 0
FileTo = "C:\ToPath\" & i & ".bmp"
FileCopy FileFrom, FileTo
CurrentDb.Execute "INSERT INTO Image ( ImagePath ) VALUES ( '" &
FileTo & "' )"
Kill FileFrom
i = i + 1
FileFrom = Dir("C:\FromPath\*.bmp")
Loop
 
for i, you can use a timestamp (but remove the special characters that
can't be used for a filename)

for example:

i = replace(replace(now(),":","-"),"/","-")
 

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