GMan
05-20-2009, 04:36 AM
I have a procedure that collects information into an Array and then calls a procedure to attach a file using the information. I originally had the Load of data and the call to attach the file in two seperate procedures with the array defined globally. I have moved it into 1 procedure and seems to have fixed an issue with accessing the data. But know the call to attach the data is not working. Can someone tell me what I am doing wrong?
Public arFiles()
Sub Manage_Array(stProcess As String, stFileName As String, stDescription As String)
If stProcess = "Load" Then
iInst = iInst + 1
ReDim Preserve arFiles(1 To iInst)
arFiles(iInst) = Array(iRow, iCol, stFileName, stDescription)
SITForm2.lbMessage = "File " & stDescription & " has been QUEUED."
SITForm2.tbFileName = Null
SITForm2.tbDescription = Null
End If
If stProcess = "Attach" Then
iCnt = 1
Do Until iCnt > iInst
Call Attach_File(Int(arFiles(iCnt)(0)), Int(arFiles(iCnt)(1)), _
Str(arFiles(iCnt)(2)), Str(arFiles(iCnt)(3)), iInst)
iCnt = iCnt + 1
Loop
iInst = 0
ReDim arFiles(iInst)
End If
End Sub
I am receiving a "TYPE MISMATCH" on the CALL ATTACH_FILE. However, I can move the array fields to other fields and make the call using the new fields. Although this works it seems sloppy to me. The define of ATTACCH_FILE is below.
Sub Attach_File(iInvoiceRow As Integer, iCol As Integer, _
stFileName As String, stDescription As String, iTotal As Integer)
Public arFiles()
Sub Manage_Array(stProcess As String, stFileName As String, stDescription As String)
If stProcess = "Load" Then
iInst = iInst + 1
ReDim Preserve arFiles(1 To iInst)
arFiles(iInst) = Array(iRow, iCol, stFileName, stDescription)
SITForm2.lbMessage = "File " & stDescription & " has been QUEUED."
SITForm2.tbFileName = Null
SITForm2.tbDescription = Null
End If
If stProcess = "Attach" Then
iCnt = 1
Do Until iCnt > iInst
Call Attach_File(Int(arFiles(iCnt)(0)), Int(arFiles(iCnt)(1)), _
Str(arFiles(iCnt)(2)), Str(arFiles(iCnt)(3)), iInst)
iCnt = iCnt + 1
Loop
iInst = 0
ReDim arFiles(iInst)
End If
End Sub
I am receiving a "TYPE MISMATCH" on the CALL ATTACH_FILE. However, I can move the array fields to other fields and make the call using the new fields. Although this works it seems sloppy to me. The define of ATTACCH_FILE is below.
Sub Attach_File(iInvoiceRow As Integer, iCol As Integer, _
stFileName As String, stDescription As String, iTotal As Integer)