M
Mike
Below is some code that I did with the help of an MVP on a slightly different
project. I keep getting a "File Not Found" error, and I can't see where I've
goofed it up. Can anyone help?
Private Sub Command3_Click()
Dim strOldName As String
Dim strNewName As String
Dim strOldFolder As String
Dim strNewFolder As String
Dim dbCurr As DAO.Database
Dim rsCurr As DAO.Recordset
strSQL = "SELECT ProductID FROM Products"
Set dbCurr = CurrentDb()
Set rsCurr = dbCurr.OpenRecordset(strSQL)
Do While rsCurr.EOF = False
strOldFolder = "C:\Documents and Settings\Mike\My Documents\Walfield\LNC
Pet Supply\a-e\"
strNewFolder = "C:\Documents and Settings\Mike\My Documents\Walfield\LNC
Pet Supply\ProductImages\"
strOldName = strOldFolder & rsCurr!ProductID & ".jpg" ' Define file names.
strNewName = strNewFolder & rsCurr!ProductID & ".jpg"
If (Len(Dir(strOldName)) > 0) Then
Name "strOldName" As "strNewName"
End If
rsCurr.MoveNext
Loop
End Sub
project. I keep getting a "File Not Found" error, and I can't see where I've
goofed it up. Can anyone help?
Private Sub Command3_Click()
Dim strOldName As String
Dim strNewName As String
Dim strOldFolder As String
Dim strNewFolder As String
Dim dbCurr As DAO.Database
Dim rsCurr As DAO.Recordset
strSQL = "SELECT ProductID FROM Products"
Set dbCurr = CurrentDb()
Set rsCurr = dbCurr.OpenRecordset(strSQL)
Do While rsCurr.EOF = False
strOldFolder = "C:\Documents and Settings\Mike\My Documents\Walfield\LNC
Pet Supply\a-e\"
strNewFolder = "C:\Documents and Settings\Mike\My Documents\Walfield\LNC
Pet Supply\ProductImages\"
strOldName = strOldFolder & rsCurr!ProductID & ".jpg" ' Define file names.
strNewName = strNewFolder & rsCurr!ProductID & ".jpg"
If (Len(Dir(strOldName)) > 0) Then
Name "strOldName" As "strNewName"
End If
rsCurr.MoveNext
Loop
End Sub