Software version: Microsoft Access 2003
I have a table called SoldImagesCars
This table has three fields
id (primary key)
lotno (Data Type - number)
regno (Data Type - Text)
I also have a form called frmSplash which gets the data from the above table.
The following code VB code is called using a Command Button on the form fmrSplash and moves the matching images for the first row in the table.
i.e. id=1, lotno=156, regno=aa05 aaa
Image in C:\testfolder\Cars\ folder named 156 - aa05 aaa
This code works perfectly to move the matching images for the first row in the table.
The problem I'm having is that I would like the code to loop to move pictures for all the rows in the table called SoldImagesCars.
There would only be about 10-15 rows in this table.
I've tried a few loop examples I found on the web but to no avail. What do I need to do?
Many thanks in advance,
Rhys
I have a table called SoldImagesCars
This table has three fields
id (primary key)
lotno (Data Type - number)
regno (Data Type - Text)
I also have a form called frmSplash which gets the data from the above table.
The following code VB code is called using a Command Button on the form fmrSplash and moves the matching images for the first row in the table.
i.e. id=1, lotno=156, regno=aa05 aaa
Image in C:\testfolder\Cars\ folder named 156 - aa05 aaa
Code:
Private Sub Command464_Click()
Dim fso, f, f1, fc, s
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder("[URL="file://\\Mma6\backup"]\[COLOR=#000000]C:\testfolder\Cars\[/COLOR][/URL]") '
Set fc = f.Files
FileCount = 0
If fc.Count <> 0 Then
For Each File In fc
If InStr(UCase(File.Name), ".jpg") > 0 Then
FileCount = FileCount + 1
Call MoveAndRenameMyFile("C:\testfolder\Cars\", Me![lotno] & " - " & Me![RegNo] & "*.jpg", "C:\testfolder\Cars\Sold\" & Me![lotno] & " - " & Me![RegNo] & " (" & FileCount & ").jpg")
Else
End If
Next
End If
End Sub
This code works perfectly to move the matching images for the first row in the table.
The problem I'm having is that I would like the code to loop to move pictures for all the rows in the table called SoldImagesCars.
There would only be about 10-15 rows in this table.
I've tried a few loop examples I found on the web but to no avail. What do I need to do?
Many thanks in advance,
Rhys