i'm trying to copy a group of wave files from several folders to one folder based on the results of a query. the only difference in the original paths would be based on the date they were sold and the phone number (.wav files named after the phone numbers placed in folders named for each day)
i think i'm close with what i have below, it worked with individual files but when i tryed to get it to loop through a recordset i get a type mismatch error.
this is the bad code:
Private Sub Command45_Click()
On Error GoTo Err_Command45_Click
Dim dt As String
Dim rs As ADODB.Recordset
Dim stPath As String
Dim stFile As String
Dim stPhone As String
Dim stWav As String
Dim stWUD_Date As String
Dim strSource As String
Dim strDestination As String
Dim strWUDC_Date As String
Set rs = Forms!retrieve_test_form.RecordsetClone
rs.MoveFirst
Do While Not rs.EOF
stWUD_Date = CStr(rs.Fields("write up date"))
stPath = "\\Sunserver\Suntasia\Recordings\Shift_Capital_Recordings\" & stWUD_Date & "\"
stPhone = rs.Fields("phone")
stWav = ".wav"
stFile = stPhone & stWav
strSource = stPath & stFile
strDestination = "C:\retrieve_test\" & stFile
FileCopy strSource, strDestination
rs.MoveNext
Loop
Exit_Command45_Click:
Exit Sub
Err_Command45_Click:
MsgBox Err.Description
Resume Exit_Command45_Click
End Sub
this is the good code (for single records):
Private Sub Retrieve_Recording_Click()
On Error GoTo Err_Retrieve_Recording_Click
Dim stPath As String
Dim stFile As String
Dim stPhone As String
Dim stWav As String
Dim stWUD_Date As String
Dim strSource As String
Dim strDestination As String
stWUD_Date = CStr(Me.Write_Up_Date.Value)
stPath = "\\Sunserver\Suntasia\Recordings\Shift_Capital_Recordings\" & stWUD_Date & "\"
stPhone = Me.Phone.Value
stWav = ".wav"
stFile = stPhone & stWav
strSource = stPath & stFile
strDestination = "C:\retrieve_test\" & stFile
FileCopy strSource, strDestination
Exit_Retrieve_Recording_Click:
Exit Sub
Err_Retrieve_Recording_Click:
MsgBox Err.Description
Resume Exit_Retrieve_Recording_Click
End Sub
any help would be greatly appriciated
i think i'm close with what i have below, it worked with individual files but when i tryed to get it to loop through a recordset i get a type mismatch error.
this is the bad code:
Private Sub Command45_Click()
On Error GoTo Err_Command45_Click
Dim dt As String
Dim rs As ADODB.Recordset
Dim stPath As String
Dim stFile As String
Dim stPhone As String
Dim stWav As String
Dim stWUD_Date As String
Dim strSource As String
Dim strDestination As String
Dim strWUDC_Date As String
Set rs = Forms!retrieve_test_form.RecordsetClone
rs.MoveFirst
Do While Not rs.EOF
stWUD_Date = CStr(rs.Fields("write up date"))
stPath = "\\Sunserver\Suntasia\Recordings\Shift_Capital_Recordings\" & stWUD_Date & "\"
stPhone = rs.Fields("phone")
stWav = ".wav"
stFile = stPhone & stWav
strSource = stPath & stFile
strDestination = "C:\retrieve_test\" & stFile
FileCopy strSource, strDestination
rs.MoveNext
Loop
Exit_Command45_Click:
Exit Sub
Err_Command45_Click:
MsgBox Err.Description
Resume Exit_Command45_Click
End Sub
this is the good code (for single records):
Private Sub Retrieve_Recording_Click()
On Error GoTo Err_Retrieve_Recording_Click
Dim stPath As String
Dim stFile As String
Dim stPhone As String
Dim stWav As String
Dim stWUD_Date As String
Dim strSource As String
Dim strDestination As String
stWUD_Date = CStr(Me.Write_Up_Date.Value)
stPath = "\\Sunserver\Suntasia\Recordings\Shift_Capital_Recordings\" & stWUD_Date & "\"
stPhone = Me.Phone.Value
stWav = ".wav"
stFile = stPhone & stWav
strSource = stPath & stFile
strDestination = "C:\retrieve_test\" & stFile
FileCopy strSource, strDestination
Exit_Retrieve_Recording_Click:
Exit Sub
Err_Retrieve_Recording_Click:
MsgBox Err.Description
Resume Exit_Retrieve_Recording_Click
End Sub
any help would be greatly appriciated