I am a newbie to Access and VBA and I'm having trouble finding how to determine whether a file is a zip or txt from a recordset, and calling the appropriate function for said files. Does anyone see anything wrong with this? Help is greatly appreciated.
Code:
Sub Test_2(strTableName As String)
Dim objRecordset As Recordset
Dim strUnzipOrMoveFile_RETURN As String
Dim strUnzipFile_RETURN As String
Set objRecordset = CurrentDb.OpenRecordset("SELECT * FROM " & strTableName)
Do While Not objRecordset.EOF
Select Case Right(objRecordset.Fields("Source"), 4)
Case ".zip"
'Unzip it
strUnzipOrMoveFile_RETURN = UnzipFile(CVar(objRecordset.Fields("Source")), CVar(objRecordset.Fields("Destination")))
Case ".txt"
'Move it
strUnzipOrMoveFile_RETURN = moveFiles(CVar(objRecordset.Fields("Source")), CVar(objRecordset.Fields("Destination")))
End Select
objRecordset.MoveNext
Loop
End Sub