Wouter Raats
New member
- Local time
- Today, 18:25
- Joined
- Nov 5, 2013
- Messages
- 6
I have a problem with trying to execute a command for each record in a recordset. What I'm trying to build is a file distribution system. I have a form with the path where the source file is and a subform with a couple of records where the destination path is defined. I use the code you will find below, but it will only copy the file to the destination from the first record. Can somebody help me to solve the problem? So the code will do the filecopy command for every destination.
Code:
Dim Sourcepath, Destinationpath
Sourcepath = Forms![Item distribution]![Item source path]
Destinationpath = Me.Destination_path
Dim rs As DAO.Recordset
Set rs = Me.Form.Recordset
If Not (rs.BOF And rs.EOF) Then
rs.MoveFirst
FileCopy Sourcepath, Destinationpath
Else
Do While Not rs.EOF = True
rs.Edit
FileCopy Sourcepath, Destinationpath
rs.Update
rs.MoveNext
Loop
End If