duplicate file names

C

Chris

Hello Again

I'm saving word files into a clients folder through Access (The database
application) The files are taken from a template folder and saved into the
clients folder and renamed with the format (dd-mmDocumentname) However, I'm
running into trouble when the same document is saved for the same client on
the same day.

Is there anyway of detecting if the folder already contains a document with
the same name as the one that is being saved? If so, how would you change
the document name?

thanks
 
S

StCyrM

Good afternoon

You could add the hh:mm ( hour, minute) at the front of the document as well as
the dd-mm, so that your filename would now be saved as dd-mm-hh-mmDocumentName

Best Regards

Maurice St-Cyr
Micro Systems Consultants, Inc.
 
B

Brendan Reynolds

Public Function FileExists(ByVal strPathName As String) As Boolean

If Dir(strPathName, vbNormal) <> vbNullString Then
FileExists = True
End If

End Function

Public Sub RenameFile(ByVal strOldPathName As String, ByVal strNewPathName
As String)

Name strOldPathName As strNewPathName

End Sub

Examples of use, in the Immediate window ...

? fileexists("C:\Test1\Test1.txt")
True
renamefile "C:\Test1\Test1.txt", "C:\Test1\Test2.txt"

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
C

Chris

No good for the client!

I need the code for the searching if the client code exists as well (If it
does I'll increment it by one) Client code = first 3 letters of surname and
an integer starting at 001. e.g. SMI001
 

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

Top