S
Sam
Hello!
I have a problem ftp a txt file to unix after converting the database from
MS Access 97 to 2003.
The codes are below, basically it passes a file call1.txt to a unix server
zsindv12. Somehow the file is always FTPNOTOK. I don't have such problems
when I was using Access 97. Are there any options i did not check or codes
that may not be applicable to Access 2003 anymore?
Thanks to enlighten. Sam.
===============================================
Dim txt_pass As String, txt_user As String
Dim messagebox
Dim ftp_target
Dim delete_file
Dim wait_count As Integer
Dim loop_count As Integer
Dim count_loop As Integer
Dim txt_call As String, txt_spread As String
Dim fs1, fs2, msg
txtuser.SetFocus
txt_user = Forms!ftp_unix!txtuser.Text
txtpass.SetFocus
txt_pass = Forms!ftp_unix!txtpass.Text
Open "S:\call_spread\ftp_status_new.txt" For Output As #1 ' Open
file for output.
Print #1, "FTPNOTOK"
Close
If chk_call And chk_spread Then
txt_call = "send S:\call_spread\call1.txt"
txt_spread = "send S:\call_spread\spread.txt"
Set fs1 = Application.FileSearch
With fs1
.LookIn = "S:\call_spread"
.FileName = "call1.txt"
If .Execute() > 0 Then
Else
msg = MsgBox("Call Interest file is empty. Please import and
generate file again.", vbInformation, "Please take note")
GoTo finish
End If
End With
Set fs2 = Application.FileSearch
With fs2
.LookIn = "S:\call_spread"
.FileName = "spread.txt"
If .Execute() > 0 Then
Else
msg = MsgBox("Spread Input file is empty. Please import and
generate file again.", vbInformation, "Please take note")
GoTo finish
End If
End With
ElseIf chk_call And chk_spread = False Then
txt_call = "send S:\call_spread\call1.txt"
txt_spread = ""
Set fs1 = Application.FileSearch
With fs1
.LookIn = "S:\call_spread"
.FileName = "call1.txt"
If .Execute() > 0 Then
Else
msg = MsgBox("Call Interest file is empty. Please import and
generate file again.", vbInformation, "Please take note")
GoTo finish
End If
End With
ElseIf chk_call = False And chk_spread Then
txt_call = ""
txt_spread = "send S:\call_spread\spread.txt"
Set fs1 = Application.FileSearch
With fs1
.LookIn = "S:\call_spread"
.FileName = "spread.txt"
If .Execute() > 0 Then
Else
msg = MsgBox("Spread Input file is empty. Please import and
generate file again.", vbInformation, "Please take note")
GoTo finish
End If
End With
Else
messagebox = MsgBox("Please select which export file you wish to send.",
vbInformation, "Please take note")
GoTo final
End If
If txt_user <> "" And txt_pass <> "" Then
Open "S:\call_spread\FTP_unix_import.txt" For Output As #1 ' Open
file for output.
Print #1, "open zsindv12"
Print #1, txt_user
Print #1, txt_pass
Print #1, "cd /dvd/ftp/call_spread"
Print #1, txt_call
Print #1, txt_spread
Print #1, "get ftp_status_new.txt S:\call_spread\ftp_status_new.txt"
Print #1, "quit"
Close
delete_file = Shell("cmd /c ftp -s:S:\call_spread\FTP_unix_import.txt")
ReDim ftp_check1(3)
count_loop = 1
loop_count = 1
Screen.MousePointer = 11
txtuser.SetFocus
Forms!ftp_unix!Command8.Enabled = False
txtuser.SetFocus
Text10.Visible = False
progressbar.Visible = True
progressbar.SetFocus
For loop_count = 1 To 10000
wait_count = 1
For wait_count = 1 To 10000
wait_count = wait_count + 1
Next wait_count
loop_count = loop_count + 1
progressbar.Value = loop_count
Next loop_count
Open "S:\call_spread\ftp_status_new.txt" For Input As #1
Do While Not EOF(1)
Line Input #1, ftp_check1(count_loop)
count_loop = count_loop + 1
Loop
Close
Debug.Print ftp_check1(1)
Screen.MousePointer = 1
If ftp_check1(1) = "FTPOK" Then
messagebox = MsgBox("FTP to server was successful.", vbInformation,
"Please take note")
delete_file = Shell("cmd /c del S:\call_spread\FTP_unix_import.txt")
delete_file = Shell("cmd /c del S:\call_spread\ftp_status_new.txt")
delete_file = Shell("cmd /c del S:\call_spread\spread.txt")
delete_file = Shell("cmd /c del S:\call_spread\call1.txt")
GoTo finish
Else
messagebox = MsgBox("FTP to server was not successful" & vbCrLf &
"Please enter your login details again.", vbInformation, "Please take note")
txtuser.SetFocus
progressbar.Visible = False
Command8.Enabled = True
delete_file = Shell("cmd /c del S:\call_spread\FTP_unix_import.txt")
delete_file = Shell("cmd /c del S:\call_spread\ftp_status_new.txt")
GoTo final
End If
Else
messagebox = MsgBox("Please enter your FTP login details.",
vbInformation, "Please take note")
GoTo final
End If
finish:
DoCmd.Close acForm, "ftp_unix"
final:
delete_file = Shell("cmd /c del S:\call_spread\ftp_status_new.txt")
End Sub
I have a problem ftp a txt file to unix after converting the database from
MS Access 97 to 2003.
The codes are below, basically it passes a file call1.txt to a unix server
zsindv12. Somehow the file is always FTPNOTOK. I don't have such problems
when I was using Access 97. Are there any options i did not check or codes
that may not be applicable to Access 2003 anymore?
Thanks to enlighten. Sam.
===============================================
Dim txt_pass As String, txt_user As String
Dim messagebox
Dim ftp_target
Dim delete_file
Dim wait_count As Integer
Dim loop_count As Integer
Dim count_loop As Integer
Dim txt_call As String, txt_spread As String
Dim fs1, fs2, msg
txtuser.SetFocus
txt_user = Forms!ftp_unix!txtuser.Text
txtpass.SetFocus
txt_pass = Forms!ftp_unix!txtpass.Text
Open "S:\call_spread\ftp_status_new.txt" For Output As #1 ' Open
file for output.
Print #1, "FTPNOTOK"
Close
If chk_call And chk_spread Then
txt_call = "send S:\call_spread\call1.txt"
txt_spread = "send S:\call_spread\spread.txt"
Set fs1 = Application.FileSearch
With fs1
.LookIn = "S:\call_spread"
.FileName = "call1.txt"
If .Execute() > 0 Then
Else
msg = MsgBox("Call Interest file is empty. Please import and
generate file again.", vbInformation, "Please take note")
GoTo finish
End If
End With
Set fs2 = Application.FileSearch
With fs2
.LookIn = "S:\call_spread"
.FileName = "spread.txt"
If .Execute() > 0 Then
Else
msg = MsgBox("Spread Input file is empty. Please import and
generate file again.", vbInformation, "Please take note")
GoTo finish
End If
End With
ElseIf chk_call And chk_spread = False Then
txt_call = "send S:\call_spread\call1.txt"
txt_spread = ""
Set fs1 = Application.FileSearch
With fs1
.LookIn = "S:\call_spread"
.FileName = "call1.txt"
If .Execute() > 0 Then
Else
msg = MsgBox("Call Interest file is empty. Please import and
generate file again.", vbInformation, "Please take note")
GoTo finish
End If
End With
ElseIf chk_call = False And chk_spread Then
txt_call = ""
txt_spread = "send S:\call_spread\spread.txt"
Set fs1 = Application.FileSearch
With fs1
.LookIn = "S:\call_spread"
.FileName = "spread.txt"
If .Execute() > 0 Then
Else
msg = MsgBox("Spread Input file is empty. Please import and
generate file again.", vbInformation, "Please take note")
GoTo finish
End If
End With
Else
messagebox = MsgBox("Please select which export file you wish to send.",
vbInformation, "Please take note")
GoTo final
End If
If txt_user <> "" And txt_pass <> "" Then
Open "S:\call_spread\FTP_unix_import.txt" For Output As #1 ' Open
file for output.
Print #1, "open zsindv12"
Print #1, txt_user
Print #1, txt_pass
Print #1, "cd /dvd/ftp/call_spread"
Print #1, txt_call
Print #1, txt_spread
Print #1, "get ftp_status_new.txt S:\call_spread\ftp_status_new.txt"
Print #1, "quit"
Close
delete_file = Shell("cmd /c ftp -s:S:\call_spread\FTP_unix_import.txt")
ReDim ftp_check1(3)
count_loop = 1
loop_count = 1
Screen.MousePointer = 11
txtuser.SetFocus
Forms!ftp_unix!Command8.Enabled = False
txtuser.SetFocus
Text10.Visible = False
progressbar.Visible = True
progressbar.SetFocus
For loop_count = 1 To 10000
wait_count = 1
For wait_count = 1 To 10000
wait_count = wait_count + 1
Next wait_count
loop_count = loop_count + 1
progressbar.Value = loop_count
Next loop_count
Open "S:\call_spread\ftp_status_new.txt" For Input As #1
Do While Not EOF(1)
Line Input #1, ftp_check1(count_loop)
count_loop = count_loop + 1
Loop
Close
Debug.Print ftp_check1(1)
Screen.MousePointer = 1
If ftp_check1(1) = "FTPOK" Then
messagebox = MsgBox("FTP to server was successful.", vbInformation,
"Please take note")
delete_file = Shell("cmd /c del S:\call_spread\FTP_unix_import.txt")
delete_file = Shell("cmd /c del S:\call_spread\ftp_status_new.txt")
delete_file = Shell("cmd /c del S:\call_spread\spread.txt")
delete_file = Shell("cmd /c del S:\call_spread\call1.txt")
GoTo finish
Else
messagebox = MsgBox("FTP to server was not successful" & vbCrLf &
"Please enter your login details again.", vbInformation, "Please take note")
txtuser.SetFocus
progressbar.Visible = False
Command8.Enabled = True
delete_file = Shell("cmd /c del S:\call_spread\FTP_unix_import.txt")
delete_file = Shell("cmd /c del S:\call_spread\ftp_status_new.txt")
GoTo final
End If
Else
messagebox = MsgBox("Please enter your FTP login details.",
vbInformation, "Please take note")
GoTo final
End If
finish:
DoCmd.Close acForm, "ftp_unix"
final:
delete_file = Shell("cmd /c del S:\call_spread\ftp_status_new.txt")
End Sub