I have a form from one of the gurus on site and I have tried to tweak the code to show a directory per record (Access2000) Its half working I open up the form and get "13- type mismatch"
vDir seems to be empty (I have pt a file in their to veiw)
running the cursor over QteNo & qteinsnme - both have what I expect in them (A number and a name respectively)
howver Vir seems to be empty and when i debug it oes straight to "Resume Exit_FilesAndDetails) second from bottom line of code copy code below
Private Function FilesAndDetails()
On Error GoTo Err_FilesAndDetails
Dim rs As Recordset
Dim vDir As Variant
Dim sPath As Variant
sPath = "C:\Coverex international\" & "Forms!main!QteNo" & " " & "Forms!main!QteInsnme" & " \"
'Const sPath = "C:\Coverex international\(Me!QteNo)(Me!QteInsnme)\ """
' Const sPath = "C:\temp\" 'sPath must end with a back slash, sPath = "C:\Windows\"
CurrentDb.Execute "Delete tTempFiles.* from tFiles;"
Set rs = CurrentDb.OpenRecordset("tFiles")
vDir = Dir(sPath & "*.*")
Do Until vDir = ""
rs.AddNew
rs!FilePathName = sPath & vDir
rs!FilePath = sPath
rs!FileName = vDir
rs!ModifiedDate = FileDateTime(sPath & vDir)
rs!FileSize = FileLen(sPath & vDir)
rs.Update
vDir = Dir
Loop
rs.Close
Set rs = Nothing
DoCmd.Requery
Exit_FilesAndDetails:
Exit Function
Err_FilesAndDetails:
MsgBox Err.Number & " - " & Err.Description
Resume Exit_FilesAndDetails ******yellow highlight here
End Function
vDir seems to be empty (I have pt a file in their to veiw)
running the cursor over QteNo & qteinsnme - both have what I expect in them (A number and a name respectively)
howver Vir seems to be empty and when i debug it oes straight to "Resume Exit_FilesAndDetails) second from bottom line of code copy code below
Private Function FilesAndDetails()
On Error GoTo Err_FilesAndDetails
Dim rs As Recordset
Dim vDir As Variant
Dim sPath As Variant
sPath = "C:\Coverex international\" & "Forms!main!QteNo" & " " & "Forms!main!QteInsnme" & " \"
'Const sPath = "C:\Coverex international\(Me!QteNo)(Me!QteInsnme)\ """
' Const sPath = "C:\temp\" 'sPath must end with a back slash, sPath = "C:\Windows\"
CurrentDb.Execute "Delete tTempFiles.* from tFiles;"
Set rs = CurrentDb.OpenRecordset("tFiles")
vDir = Dir(sPath & "*.*")
Do Until vDir = ""
rs.AddNew
rs!FilePathName = sPath & vDir
rs!FilePath = sPath
rs!FileName = vDir
rs!ModifiedDate = FileDateTime(sPath & vDir)
rs!FileSize = FileLen(sPath & vDir)
rs.Update
vDir = Dir
Loop
rs.Close
Set rs = Nothing
DoCmd.Requery
Exit_FilesAndDetails:
Exit Function
Err_FilesAndDetails:
MsgBox Err.Number & " - " & Err.Description
Resume Exit_FilesAndDetails ******yellow highlight here
End Function