Hey guys,
I'am Having a really weird behaviour from the program.
When I execute the Program (Debug/Run) everything goes smothly.
It runs perfectly and does all it needs to do.
The PROBLEM Start When I'am trying to compile the Program (File/Compile/Devise.exe).
It pops an Error:
"Error Compiling Program
Error Message : Index was out of range. Must be non - negative and less than the size of collection
Parameter name : index
Line Number : 511
Line: strBuildLine = padc(arrProducts(Count).OrgQtyBO, 4) & " " & _
padc(arrProducts(Count).PrDescription, 30) & " " & _
padc(finderrorstr(arrProducts(Count).ProductCode), 15)"
Here's the Code :
NEED HELP PLEASE, URGENT
I'am Having a really weird behaviour from the program.
When I execute the Program (Debug/Run) everything goes smothly.
It runs perfectly and does all it needs to do.
The PROBLEM Start When I'am trying to compile the Program (File/Compile/Devise.exe).
It pops an Error:
"Error Compiling Program
Error Message : Index was out of range. Must be non - negative and less than the size of collection
Parameter name : index
Line Number : 511
Line: strBuildLine = padc(arrProducts(Count).OrgQtyBO, 4) & " " & _
padc(arrProducts(Count).PrDescription, 30) & " " & _
padc(finderrorstr(arrProducts(Count).ProductCode), 15)"
Here's the Code :
B4X:
Sub Globals
'Declare the global variables here.
Dim Serveur As String
Dim User As String
Dim PW As String
Dim OrderNo As String
Dim lMouseDn As Boolean
Dim lAskCommande As Boolean
Dim ImagePath As String
Dim aItem(300,8) As String
Dim aDepot(50,8) As String
Dim MasterItem As Number
Dim LeNumeroduPortable As String
Dim lCamion As Boolean
Dim lLogin As Boolean
Dim MasterIndex As Number
Dim cNom As String
Dim cTel As String
Dim cAdr As String
Dim cVil As String
Dim cProv As String
Dim cCP As String
Dim cPay As String
Dim lEnglish As Boolean
'Dim Alfiles(0) As String
Dim DialogToShow As Number
Dim PrtPort As Number
Dim cTerms As String
Dim cNote As String
Dim Lemenu As Integer
Dim oldstatus As String
Dim mNom As String
Dim mTel As String
Dim mAdr As String
Dim mVil As String
Dim mProv As String
Dim mCP As String
Dim mPort As String
Dim mNoTPS As String
Dim mNoTVQ As String
Dim nTPSpct As Number
Dim nTVQpct As Number
Dim mFax As String
' When adding another field, you must add 1 for each field added into the array arrMaxFieldCounts(0) (FormMain.Show Method)
' This is for redim the array we have to specefy the numbers of columns or else it will give ERRORS.
Dim Type (ProductCode, PrDescription, OrgQtyBO, OrgQtyShipped, OrgQtyOrdered, NewOrderedQty, NewShippedQty, NewBoQty, Sequence, PrHasComponents, RefPrSequence, PrIsComponent, IsNewOrder, Price, TaxRate1, TaxRate2, TaxAmount1, TaxAmount2, OrgTaxAmount1, OrgTaxAmount2) arrProducts(0)
Dim Type (ProductCode, Quantity, Price, TaxRate1, TaxRate2, TaxAmount1, TaxAmount2, Comments, IsDeleted) arrReturns(0)
Dim Type (ProductCode, Quantity, Comments, IsDeleted) arrTempReturns(0)
Dim Type (PackingSlipNo, Company, Adress, City, Province, PostalCode, Telephone, Terms, Comments, IsOrderCompleted) arrPackingSlipsHdr(0)
Dim Type (intArrProductFieldCount, intArrReturnsFieldCount, intArrPackingSlipHdr) arrMaxFieldCounts(1)
' BE ADVISED, When Modifying any of the Top Dim Type arrays, you must add the number of fields
' in these arrays
Dim strWords(3) As String
Dim arrSplitReturns(8)
Dim arrSplitPackingSlipHdr(10) As String ' This array goes for arrPackingSlipsHdr
Dim arrSplitPackingSlipDet(11) As String ' This array goes for arrProducts
Dim strTitle As String
Dim strMessage As String
Dim blnShowButton As Boolean
Dim strConfigfile As String
Dim strImagesPath As String
Dim strPackingSlipHeaderPath As String
Dim strPackingSlipDetailsPath As String
Dim strInvoicePath As String
Dim strNotesPath As String
Dim strReturnsPath As String
Dim intListSelectedIndex As Integer
Dim blnIsNewCrn As Boolean
End Sub
Sub Commande_Show
Dim res
Dim i As Number
Dim Query As String
Dim intNbProduct As Integer
Dim Count As Integer
Dim strBarCode As String
Dim strBuildLine As String
Count = 0
timer3.Enabled =True
Commande.Text =orderno
For i=0 To 299
aitem(i,0)=""
aitem(i,1)=""
aitem(i,2)=""
aitem(i,3)=""
aitem(i,4)=""
aitem(i,5)=""
aitem(i,6)=""
aitem(i,7)=""
Next
'Clear all the value from the arrProducts
EmptyCommandFields
i = 0
ListItems.Clear
openconn
Query = "SELECT COUNT(*) AS PrCount" & CRLF & _
"FROM [dbo].[OE_Order_Details]" & CRLF & _
"WHERE [OrderNo] = " & OrderNo
Conn.ExecuteQuery(Query)
Conn.Advance
intNbProduct = conn.ReadField("PrCount")
' Redim the array to the number of record found from the order
Dim arrProducts(intNbProduct, arrMaxFieldCounts(0).intArrProductFieldCount)
Query = "SELECT *" & CRLF & _
"FROM [dbo].[OE_Order_Details]" & CRLF & _
"WHERE [OrderNo] = " & OrderNo & CRLF & _
"ORDER BY Sequence"
res = conn.ExecuteQuery(Query)
Do While conn.Advance
If StrLength(conn.ReadField("BarCode")) > 0 Then
arrProducts(Count).ProductCode = conn.ReadField("BarCode")
Else
arrProducts(Count).ProductCode = conn.ReadField("ProductNo")
End If
arrProducts(Count).PrDescription = conn.ReadField("ProductDesc")
arrProducts(Count).OrgQtyOrdered = conn.ReadField("QtyOrdered")
arrProducts(Count).OrgQtyShipped = conn.ReadField("QtyShipped")
arrProducts(Count).OrgQtyBO = conn.ReadField("QtyBackOrdered")
arrProducts(Count).NewOrderedQty = arrProducts(Count).OrgQtyBO
arrProducts(Count).NewShippedQty = arrProducts(Count).OrgQtyShipped
arrProducts(Count).NewBoQty = arrProducts(Count).OrgQtyBO
arrProducts(Count).Sequence = conn.ReadField("Sequence")
If conn.ReadField("PrHasComponent") = 1 Then arrProducts(Count).PrHasComponents = True Else arrProducts(Count).PrHasComponents = False
If conn.ReadField("PrIsComponent") = 1 Then arrProducts(Count).PrIsComponent = True Else arrProducts(Count).PrIsComponent = False
arrProducts(Count).RefPrSequence = conn.ReadField("RefProdSequence")
arrProducts(Count).IsNewOrder = False
strBuildLine = padc(arrProducts(Count).OrgQtyBO, 4) & " " & _
padc(arrProducts(Count).PrDescription, 30) & " " & _
padc(finderrorstr(arrProducts(Count).ProductCode), 15)
ListItems.Add(strbuildLine)
Count = Count + 1
Loop
conn.Close
End Sub
NEED HELP PLEASE, URGENT