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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

EOF ?

Status
Not open for further replies.

stnkyminky

Programmer
Oct 15, 2001
476
0
0
US
I am wanting to print all the records in a database 3 times with different headings. I have accomplished this but I am having a strange problem. The table only has 7 records in it. While in the do loop I retrieve 1 records and exit the loop despite the db.project_rs.MoveNext. Why is the code exiting the loop and not retrieving the remaining records. Thanks

Do Until db.Project_rs.EOF

drInventoryTicket.Sections(3).Controls("lbltype").Caption = "FG"
drInventoryTicket.Sections(3).Controls("lblitnum").Caption = db.Project_rs("part_number")

If CInt(db.Project_rs(&quot;seqnum&quot;)) <= 9 Then
drInventoryTicket.Sections(3).Controls(&quot;lblseqnum&quot;).Caption = &quot;00000&quot;
ElseIf CInt(db.Project_rs(&quot;seqnum&quot;)) <= 99 Then
drInventoryTicket.Sections(3).Controls(&quot;lblseqnum&quot;).Caption = &quot;0000&quot;
ElseIf CInt(db.Project_rs(&quot;seqnum&quot;)) <= 999 Then
drInventoryTicket.Sections(3).Controls(&quot;lblseqnum&quot;).Caption = &quot;000&quot;
ElseIf CInt(db.Project_rs(&quot;seqnum&quot;)) <= 9999 Then
drInventoryTicket.Sections(3).Controls(&quot;lblseqnum&quot;).Caption = &quot;00&quot;
ElseIf CInt(db.Project_rs(&quot;seqnum&quot;)) <= 99999 Then
drInventoryTicket.Sections(3).Controls(&quot;lblseqnum&quot;).Caption = &quot;0&quot;
Else
drInventoryTicket.Sections(3).Controls(&quot;lblseqnum&quot;).Caption = db.Project_rs(&quot;seqnum&quot;)
End If

' PartNumber = db.Project_rs(&quot;part_number&quot;)



drInventoryTicket.Sections(3).Controls(&quot;lblum&quot;).Caption = db.Project_rs(&quot;uom&quot;)
drInventoryTicket.Sections(3).Controls(&quot;lbldescr1&quot;).Caption = db.Project_rs(&quot;descr1&quot;)
drInventoryTicket.Sections(3).Controls(&quot;lbldescr2&quot;).Caption = db.Project_rs(&quot;descr2&quot;)
drInventoryTicket.Sections(3).Controls(&quot;lblloc&quot;).Caption = db.Project_rs(&quot;loc&quot;)


'For count = 1 To db.Project_rs(&quot;qty_lbl&quot;)

For i = 1 To 3

If i = 1 Then
drInventoryTicket.Sections(3).Controls(&quot;lblcopy&quot;).Caption = &quot;Accounting Copy&quot;
'drInventoryTicket.Show
'drInventoryTicket.Orientation = rptOrientLandscape
drInventoryTicket.PrintReport False, rptRangeFromTo, 1, 1

ElseIf i = 2 Then
drInventoryTicket.Sections(3).Controls(&quot;lblcopy&quot;).Caption = &quot;Auditor Copy&quot;
'drInventoryTicket.Show
drInventoryTicket.PrintReport False, rptRangeFromTo, 1, 1

ElseIf i = 3 Then
drInventoryTicket.Sections(3).Controls(&quot;lblcopy&quot;).Caption = &quot;Material Copy&quot;
drInventoryTicket.Sections(3).Controls(&quot;lblmarker&quot;).Caption = &quot;XXXX&quot;
'drInventoryTicket.Show
drInventoryTicket.PrintReport False, rptRangeFromTo, 1, 1

End If

Next 'End 3 count loop
'update.Project_My_Conn.Execute (&quot;Update labels_fg_scott set Completed=Yes where part_number ='&quot; & db.Project_rs(&quot;part_number&quot;) & &quot;'&quot;)
'Next 'End qty count loop

'MsgBox db.Project_rs(&quot;part_number&quot;)
db.Project_rs.MoveNext

Loop Scott
Programmer Analyst
 
Looks good to me. What are you doing to fill the recordset? Maybe it only has one record in it? -Chris Didion
Matrix Automation, MCP
 
db.Project_strSql = &quot;Select * from labels_fg_scott&quot;
db.ProjectConnect
Set db.Project_rs = db.Project_My_Conn.Execute(db.Project_strSql)

If I remove all of the assignments and place a msgbox in the loop it works. Im kinda thinking its the print command??? Thanks Scott
Programmer Analyst
 
I updated the record, which I intended to do, but I decided to try and requery and it worked. I'm sure this will slow my app down but we're only using it for annual inventory purposes.

'Here is the code I added between the for-next loop and the do loop.

update.Project_My_Conn.Execute (&quot;Update labels_fg_scott set Completed = Yes where part_number = '&quot; & PartNumber & &quot;'&quot;)

db.Project_rs.Requery
Scott
Programmer Analyst
 
Still not working.... :-( It only seems to happen when I datareport1.PrintReport. When I step through it, without the PrintReport, it operates as it should.

Scott
Programmer Analyst
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top