User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Visual Basic 4 / 5 / 6 section within the Software Development category of DaniWeb, a massive community of 374,011 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,812 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Visual Basic 4 / 5 / 6 advertiser:
Views: 451 | Replies: 4
Reply
Join Date: Apr 2008
Posts: 12
Reputation: lisheen is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
lisheen lisheen is offline Offline
Newbie Poster

Do until recordset

  #1  
May 13th, 2008
Hi All,

Back again looking for some help and guidance, I have a recordset and I want to loop through this recordset until I find the field with the highest date. I am have a basic knowledge of how it should work but I have no idea what way to express the condition that means do until lastdate . I am not to sure how clear I am being but any help would be appreicated as always.

This is all I got so far

 Do While Not rs.EOF And (rs!NEXTDUEDATE > PNUM(2,ctr))
    Let PNUM(1, ctr) = rs!LastOfEMPCODE
    Let PNUM(2, ctr) = rs!NEXTDUEDATE
    Let PNUM(3, ctr) = rs!LASTPERFDATE
    Let PNUM(4, ctr) = Eqnum
    rs.MoveNext
    Let ctr = ctr + 1
  Loop



Rgds

Nora.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Nov 2006
Posts: 658
Reputation: QVeen72 is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 90
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Master Poster

Re: Do until recordset

  #2  
May 13th, 2008
Hi,

Try this :

  1. Do While Not rs.EOF
  2. Let PNUM(1, ctr) = rs!LastOfEMPCODE
  3. Let PNUM(2, ctr) = rs!NEXTDUEDATE
  4. Let PNUM(3, ctr) = rs!LASTPERFDATE
  5. Let PNUM(4, ctr) = Eqnum
  6. '
  7. rs.MoveNext
  8. Let ctr = ctr + 1
  9. If (rs!NEXTDUEDATE > PNUM(2,ctr)) Then
  10. Exit Do
  11. End If
  12. Loop

Regards
Veena
Reply With Quote  
Join Date: Apr 2008
Posts: 12
Reputation: lisheen is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
lisheen lisheen is offline Offline
Newbie Poster

Re: Do until recordset

  #3  
May 13th, 2008
Thanks very much for your help but I have encountered a problem, if there is more than one record it works fine, but on occasion there may be a new item which would only have one record in this instance an error is created. Would it be possible to add a statement that will prevent the error when only one record is encountered.

Tried adding this but it wasn't any good. Again your help is appreciated.

Do While Not rs.EOF
Let PNUM(1, ctr) = rs!WONUM
Let PNUM(2, ctr) = rs!COMPLETIONDATE
Let PNUM(3, ctr) = rs!EMPCODE
Let PNUM(4, ctr) = Eqnum
'
rs.MoveNext
Let ctr = ctr + 1
If ctr > 1 Then
If (rs!COMPLETIONDATE > PNUM(2, ctr)) Then
Exit Do
End If
End If
Loop
Reply With Quote  
Join Date: Nov 2006
Posts: 658
Reputation: QVeen72 is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 90
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Master Poster

Re: Do until recordset

  #4  
May 13th, 2008
Hi,

Try this :

  1. Do While Not rs.EOF
  2. Let PNUM(1, ctr) = rs!WONUM
  3. Let PNUM(2, ctr) = rs!COMPLETIONDATE
  4. Let PNUM(3, ctr) = rs!EMPCODE
  5. Let PNUM(4, ctr) = Eqnum
  6. '
  7. rs.MoveNext
  8. Let ctr = ctr + 1
  9. If ctr > 1 And Not rs.EOF Then
  10. If (rs!COMPLETIONDATE > PNUM(2, ctr)) Then
  11. Exit Do
  12. End If
  13. End If
  14. Loop

REgards
Veena
Reply With Quote  
Join Date: Apr 2008
Posts: 12
Reputation: lisheen is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
lisheen lisheen is offline Offline
Newbie Poster

Re: Do until recordset

  #5  
May 13th, 2008
Thanks a lot, finally got it.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb Visual Basic 4 / 5 / 6 Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum

All times are GMT -4. The time now is 10:49 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC