I am looping thru an array of data, where one element of the array contains a customer ID. As i loop thru each element, i want to retrieve the customer record based on IDCUST, so i set the browse condition accordingly. However, my view is open in IDCUST order, but the customer ID values in my array are in no particular order. The .Browse works the first time into the loop, and will continue to work as long as the next customer ID follows the previous customer. But .browse fails if the customer ID comes before.
I inserted three statements to force a new view with all the records and to position myself at the top of that view. Then everything works. This seems like a kluge.
I must be doing something wrong. There must be a better way! I can't seem to find a method that does what i want, nor can i find an example that applies to this.
I inserted three statements to force a new view with all the records and to position myself at the top of that view. Then everything works. This seems like a kluge.
I must be doing something wrong. There must be a better way! I can't seem to find a method that does what i want, nor can i find an example that applies to this.
Code:
...
Dim BatchCUST As AccpacCOMAPI.AccpacView
Dim BatchCUSTFields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "AR0024", BatchCUST
Set BatchCUSTFields = BatchCUST.Fields
...
For nLoopCounter = 1 To nInvCounter Step 1
'Next three statements needed to "reset" the old view so new browse works?
BatchCUST.Browse "", True
BatchCUST.Fetch
BatchCUST.GoTop
sGetCustStr = "(IDCUST = """ & sInvArray(nLoopCounter, 2) & """)"
BatchCUST.Browse sGetCustStr, True