×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

VB batch list method

VB batch list method

VB batch list method

(OP)
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

RE: VB batch list method

(OP)
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

RE: VB batch list method

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

RE: VB batch list method

(OP)
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>

RE: VB batch list method

(OP)
zemp,
I'm using a "fabricated" 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

RE: VB batch list method

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close