hi,
I am stuck on the filelen() command within access..
within vb I have the path stored and then I need filelen to tell me the size of the file which the path depicts..
I have :
Dim intcount As Integer, varFile As Variant, objFileFind As Object, mysize As Long, mylength As String
Set objFileFind = Application.FileSearch 'FindFiles
'Find the Files
If Me!Expr1 <> "" Then
With objFileFind
.NewSearch
.FileName = Me!Expr1 & "*.rdf" 'or whatever you want to find
.LookIn = "h:\" & Me!ProjectsCode
.SearchSubFolders = False 'if you have subfolders to search also
.Execute
'Count the files found
intcount = 0
mylength = "h:\" & Me!ProjectsCode & "\" & Me!Expr1 & "*.rdf"
FileLen (mylength)
For Each varFile In .FoundFiles
intcount = intcount + 1
Next varFile
End With
Else
End If
Me.Text9 = intcount
Me.Text10 = mylength
End Sub
this all works fine, mylength returns the pathname perfectly..
except that filelen does not like 'mylength'
it brings up an error run time 52, bad name or number...
I have seen in other threads the use of fillen with a ref such as filelen(strfile), so it must be possible...
many thanks in advance..
John.
I am stuck on the filelen() command within access..
within vb I have the path stored and then I need filelen to tell me the size of the file which the path depicts..
I have :
Dim intcount As Integer, varFile As Variant, objFileFind As Object, mysize As Long, mylength As String
Set objFileFind = Application.FileSearch 'FindFiles
'Find the Files
If Me!Expr1 <> "" Then
With objFileFind
.NewSearch
.FileName = Me!Expr1 & "*.rdf" 'or whatever you want to find
.LookIn = "h:\" & Me!ProjectsCode
.SearchSubFolders = False 'if you have subfolders to search also
.Execute
'Count the files found
intcount = 0
mylength = "h:\" & Me!ProjectsCode & "\" & Me!Expr1 & "*.rdf"
FileLen (mylength)
For Each varFile In .FoundFiles
intcount = intcount + 1
Next varFile
End With
Else
End If
Me.Text9 = intcount
Me.Text10 = mylength
End Sub
this all works fine, mylength returns the pathname perfectly..
except that filelen does not like 'mylength'
it brings up an error run time 52, bad name or number...
I have seen in other threads the use of fillen with a ref such as filelen(strfile), so it must be possible...
many thanks in advance..
John.