tu*****@aol.com wrote:
I am currently generating a hyperlink to a file located at the
following directory G:\Call Center\APP\APP_2006\APP*001 based on a
numberical value that in entered in on a form.
The problem im encountering is that the network directory that im
generating the link from has several changing variables that need to be
taken into accoun
G:\Call Center\APP\APP_2006\APP*001 - the year 2006 changes every
year. So come the year 2007 the link needs to change to that.
In addition the APP*001 - The * (astrick) represents a numberical value
that changes 1 number every 999 records and then the file name entered
in on the original for will change back to 1 and start over. Currently
this is the code that I am using
Private Sub File_Scan_Name_GotFocus()
Scanned_Contract.Text = "G:\Call Center\APP\APP_2006\APP" &
Left(File_Scan_Name.Value, 1) & "001\APP" & Right("0000" &
File_Scan_Name.Value, 3) & ".tif"
End Sub
Can someone help me out with this there has got to be an easier way.
Thank you -
Turf
If the year is 2007, and 1050 docs have been created in 2007, the folder
string will be
G:\Call Center\APP\APP_2007\APP*002\
The following code will ensure the folder exists. It creates the folder
name. All you need to do is concatenate the folder name with the
filename to do a FileCopy.
Dim strFolder As String
Dim lngCnt As Long
'get the number of documents entered this year
'change the field/table names to match your table structure)
lngCount = Dcount("ID","TableName","Year([DateEntered] = " & Year(date()))
'now divide by 999 and add 1 to get folder # in 999 increments
lngCount = (lngCount \ 999) + 1
'now create the folder name string
strFolder = "G:\Call Center\APP\APP_" & Year(date()) & _
"\APP*" & lngCount & "\"
MakeDirFolder strFolder
Private Sub MakeDirFolder(strFolder As String)
'this routine finds each folder in the path,
'starting at the root, and ensures each folder exists
Dim intFor As Integer
Dim strF As String
Dim strChar As String
Dim strTest As String
Dim strFolder1 As String
For intFor = 1 To Len(strFolder)
strChar = Mid(strFolder, intFor, 1)
strF = strF & strChar
If strChar = "\" Then
strTest = DIr(strF, vbDirectory)
If strTest = "" Then MkDir (strF)
End If
Next
End Sub