Hi,
My application is freezing up. I am unsure why.
I am running the following code. Form frmfrmDataEntry is open, a button to create a file is pressed and Form frmExportWarning is opened. I hit OK button on the frmExportWarning and then a FTP form is to open but it does not appear and the app seams to freeze up. Is there some code I need to fix? Help please.
From Form frmfrmDataEntry:
--------------------------
I am entering some data to create a file, then click a button to create a file
This opens another form frmExportWarning, which warns the user of actions to happen. The user clicks OK button which is called cmdWarnOK. (Below)
From Form frmExportWarning:
---------------------------
Private Sub cmdWarnOK_Click()
Call ChqFile
End Sub
In Module:
----------
Function ChqFile()
On Error GoTo ChqFile_Err
Dim sLocalFile As String
Dim sLocalFLD As String
Dim sArchiveFLD As String
Dim sArchDest As String
Dim sSource As String
Const q As String * 1 = """"
sLocalFLD = DLookup("LocalPath", "tblDirectories")
sArchiveFLD = DLookup("ArchivePath", "tblDirectories")
DoCmd.Echo False, ""
' Set Export Time Value
Forms!frmDataEntry!Time = Time()
sLocalFile = ("CHQ" & Format(Now(), "yymmddhhnnss") & "UPLOAD.txt")
sSource = sLocalFLD & "\" & sLocalFile
' Print Export Report
DoCmd.OpenReport "rptExportReport", acViewNormal, "", "", acNormal
' Update Export Table (tblExportData)
DoCmd.OpenQuery "qryUpdateExportDataTable", acViewNormal, acEdit
DoCmd.TransferText acExportDelim, "CLIC Tilde Export Specification", "tblExportData", sSource, False, ""
' Update History Table (tblHistory)
DoCmd.OpenQuery "qryAppendHistory", acViewNormal, acEdit
' Delete data in tblData
DoCmd.OpenQuery "qryDelete tblData", acViewNormal, acEdit
' Delete date in tblExportData
DoCmd.OpenQuery "qryDelete tblExportData", acViewNormal, acEdit
MsgBox "File " & sLocalFile & " Created.", vbInformation, ""
DoCmd.Close acForm, "frmExportWarning"
DoCmd.Close acForm, "frmfrmDataEntry"
' Open FTP form to transfer file to FTP site
DoCmd.OpenForm "frmFTPFile", acNormal, "", "", , acNormal
ChqFile_Exit:
Exit Function
ChqFile_Err:
MsgBox Error$
Resume ChqFile_Exit
End Function
My application is freezing up. I am unsure why.
I am running the following code. Form frmfrmDataEntry is open, a button to create a file is pressed and Form frmExportWarning is opened. I hit OK button on the frmExportWarning and then a FTP form is to open but it does not appear and the app seams to freeze up. Is there some code I need to fix? Help please.
From Form frmfrmDataEntry:
--------------------------
I am entering some data to create a file, then click a button to create a file
This opens another form frmExportWarning, which warns the user of actions to happen. The user clicks OK button which is called cmdWarnOK. (Below)
From Form frmExportWarning:
---------------------------
Private Sub cmdWarnOK_Click()
Call ChqFile
End Sub
In Module:
----------
Function ChqFile()
On Error GoTo ChqFile_Err
Dim sLocalFile As String
Dim sLocalFLD As String
Dim sArchiveFLD As String
Dim sArchDest As String
Dim sSource As String
Const q As String * 1 = """"
sLocalFLD = DLookup("LocalPath", "tblDirectories")
sArchiveFLD = DLookup("ArchivePath", "tblDirectories")
DoCmd.Echo False, ""
' Set Export Time Value
Forms!frmDataEntry!Time = Time()
sLocalFile = ("CHQ" & Format(Now(), "yymmddhhnnss") & "UPLOAD.txt")
sSource = sLocalFLD & "\" & sLocalFile
' Print Export Report
DoCmd.OpenReport "rptExportReport", acViewNormal, "", "", acNormal
' Update Export Table (tblExportData)
DoCmd.OpenQuery "qryUpdateExportDataTable", acViewNormal, acEdit
DoCmd.TransferText acExportDelim, "CLIC Tilde Export Specification", "tblExportData", sSource, False, ""
' Update History Table (tblHistory)
DoCmd.OpenQuery "qryAppendHistory", acViewNormal, acEdit
' Delete data in tblData
DoCmd.OpenQuery "qryDelete tblData", acViewNormal, acEdit
' Delete date in tblExportData
DoCmd.OpenQuery "qryDelete tblExportData", acViewNormal, acEdit
MsgBox "File " & sLocalFile & " Created.", vbInformation, ""
DoCmd.Close acForm, "frmExportWarning"
DoCmd.Close acForm, "frmfrmDataEntry"
' Open FTP form to transfer file to FTP site
DoCmd.OpenForm "frmFTPFile", acNormal, "", "", , acNormal
ChqFile_Exit:
Exit Function
ChqFile_Err:
MsgBox Error$
Resume ChqFile_Exit
End Function