Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB batch list method

Status
Not open for further replies.

rjean

Programmer
Mar 26, 2001
23
US
I have a method to retrieve open and ready AR batches and populate an ADO recordset for passing back to the calling program. Since upgrading to 5.1A, my client is now only seeing 1 batch record coming back from this method.

Unfortunately, I don't have an easy way to "debug" this for them. Can someone please take a look at this code and let me know if you see anything "funny"? I'm assuming the Fetch inside the loop is not returning True and it falls out of the loop.


Public Sub Batch_List()

On Error GoTo ACCPACErrorHandler


Dim lStatus As Boolean

ARINVOICE1batch.Cancel
' ARINVOICE1batch.Order = 0
ARINVOICE1batch.Browse "BTCHSTTS = 7 OR BTCHSTTS = 1", True
lStatus = ARINVOICE1batch.Fetch

' Clear ADO recordset
If oArBatch.RecordCount > 0 Then
' oArBatch.Delete adAffectGroup
oArBatch.CancelBatch
End If

' Populate ADO recordset
Do While lStatus = True
oArBatch.AddNew
oArBatch.Fields("CNTBTCH").Value = ARINVOICE1batch.Fields("CNTBTCH").Value
oArBatch.Fields("BTCHDESC").Value = ARINVOICE1batch.Fields("BTCHDESC").Value
oArBatch.Fields("DATEBTCH").Value = ARINVOICE1batch.Fields("DATEBTCH").Value
oArBatch.Fields("BTCHTYPE").Value = ARINVOICE1batch.Fields("BTCHTYPE").Value
oArBatch.Fields("BTCHSTTS").Value = ARINVOICE1batch.Fields("BTCHSTTS").Value
oArBatch.Fields("CNTINVCENT").Value = ARINVOICE1batch.Fields("CNTINVCENT").Value
oArBatch.Fields("AMTENTR").Value = ARINVOICE1batch.Fields("AMTENTR").Value
lStatus = ARINVOICE1batch.Fetch
Loop

ARINVOICE1batch.Cancel

Exit Sub

ACCPACErrorHandler: 'Display error messages

SetErrorMessage
Exit Sub

End Sub
 
OK, I found out the calling program was not checking for errors. I added some exception handling and this is what is happening:

Multiple-step operation generated errors. Check each status value: -2147217887

Any ideas? Again, this was working perfect under version 5.0

Thanks,
Randy
 
I don't see where you ae updating the table/recordset after each loop or at the end. I would place and update line within the loop as follows,

...
oArBatch.Fields("AMTENTR").Value = ARINVOICE1batch.Fields("AMTENTR").Value
lStatus = ARINVOICE1batch.Fetch
oArBatch.Update
Loop
...


Thanks and Good Luck!

zemp
 
Did some Google searching... discovered this error is related to the ADO recordset. Possibly the fact the batch description holds 60 characters vs. 30 now. I love it when I solve my own problems <g>
 
zemp,
I'm using a &quot;fabricated&quot; recordset just for passing data in/out of my object. No backend database so no update call needed. It looks like I solved the problem, however. It was the length of the description field being increased to 60 and I still had 30 in my recordset. I just tried a test after recompiling my DLL and it seems to be working fine now.

Thanks,
Randy
 
That makes sense, From the look of your code it seemed very strange that you would forget something so simple.

Glad to hear you got it working.

Thanks and Good Luck!

zemp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top