PeasNCarrots
Programmer
I am always looking to improve my code so I would like to ask anyone if the following code is efficient or can it be improved?
Sub GetGD2Data()
Dim arrTableNames(5) As String
Dim strFileExt As String
Dim iArray As Integer
Dim objFTP As FTP
Dim conTarget As String
arrTableNames(0) = "SUMMARY"
arrTableNames(1) = "DISPATCH"
arrTableNames(2) = "PACKAGE"
arrTableNames(3) = "STOPSUM"
arrTableNames(4) = "LABEL"
arrTableNames(5) = "TIM1"
arrTableNames(6) = "CENTER"
strFileExt = ".DBF"
'Download New Tables from FTP to local folder
Open AppPath & "\ftpcommand.ftp" For Output As #1
Print #1, ; "open manorwks0083"
Print #1, ; "anonymous"
Print #1, ; "anonymous"
For i = 0 To 6
Print #1, ; "get GD2Data/YesterDay/" & _
arrTableNames(i) & strFileExt & " " & """" & _
AppPath & "\Send Again\" & arrTableNames(i) & strFileExt & """"
Next
Print #1, ; "bye"
Close #1 ' Close file.
sleep 1500
'get the table
FTPFile "'" & AppPath() & "\ftpcommand.ftp'"
For i = 0 To 6
' Delete Tables to allow for new import
DoCmd.DeleteObject acTable, arrTableNames(i) & "_TEMP"
'Import new Tables
DoCmd.TransferDatabase acImport, "dbase 5.0", _
"D:\Documents and Settings\bos1bsc\My Documents\Send Again\", _
acTable, arrTableNames(i) & strFileExt, arrTableNames(i) & "_TEMP"
Next
End Sub
Sub GetGD2Data()
Dim arrTableNames(5) As String
Dim strFileExt As String
Dim iArray As Integer
Dim objFTP As FTP
Dim conTarget As String
arrTableNames(0) = "SUMMARY"
arrTableNames(1) = "DISPATCH"
arrTableNames(2) = "PACKAGE"
arrTableNames(3) = "STOPSUM"
arrTableNames(4) = "LABEL"
arrTableNames(5) = "TIM1"
arrTableNames(6) = "CENTER"
strFileExt = ".DBF"
'Download New Tables from FTP to local folder
Open AppPath & "\ftpcommand.ftp" For Output As #1
Print #1, ; "open manorwks0083"
Print #1, ; "anonymous"
Print #1, ; "anonymous"
For i = 0 To 6
Print #1, ; "get GD2Data/YesterDay/" & _
arrTableNames(i) & strFileExt & " " & """" & _
AppPath & "\Send Again\" & arrTableNames(i) & strFileExt & """"
Next
Print #1, ; "bye"
Close #1 ' Close file.
sleep 1500
'get the table
FTPFile "'" & AppPath() & "\ftpcommand.ftp'"
For i = 0 To 6
' Delete Tables to allow for new import
DoCmd.DeleteObject acTable, arrTableNames(i) & "_TEMP"
'Import new Tables
DoCmd.TransferDatabase acImport, "dbase 5.0", _
"D:\Documents and Settings\bos1bsc\My Documents\Send Again\", _
acTable, arrTableNames(i) & strFileExt, arrTableNames(i) & "_TEMP"
Next
End Sub