Problems for sure:
Not referencing recordset for FileNo
No MoveNext line
Variables enclosed in []
Why Case structure referencing form?
Code:
Dim FileNo As String
Dim FromPath As String
Dim ToPath As String
Dim OldName As String
Dim NewName As String
Dim Retval As Integer
Dim rst As DAO.Recordset
FromPath = "J:\Image Files\Live Files\"
ToPath = "J:\Image Files\Archived Files\"
Set rst = Me.RecordsetClone
If rst.RecordCount > 0 Then
rst.MoveFirst
Do While Not rst.EOF
Stop
If rst!DigitalImageSelect = True Then
MsgBox "If Statement ok"
FileNo = rst!File
OldName = FromPath & FileNo
NewName = ToPath & FileNo
Retval = 0
Dim objFSO As Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Rem:copy file to new folder
Retval = objFSO.CopyFile(OldName, NewName, True)
Set objFSO = Nothing
'Rem:Confirm copy
MsgBox "Copy/paste complete for file: " & FileNo
Else
Stop
MsgBox "Check box not selected for file: " & FileNo
End If
rst.MoveNext
Loop
Else
Stop
MsgBox "No check boxes selected"
End If
Is FileNo reference to a folder or a file? If a file is the suffix included (.pdf, .doc, .xls, etc.)?