Solved

Printing Values from a Query

Posted on 1998-10-07
3
120 Views
Last Modified: 2010-04-30
I am trying to print the values from an Access query but it will only print the first record.  What modifications are necessary to this code.


------------------------------
    qry.MoveFirst
    For i = 1 To qry.RecordCount
        Print #1, fld.Value
        qry.MoveNext
    Next i
------------------------------
0
Comment
Question by:JasonBurt
  • 2
3 Comments
 
LVL 9

Accepted Solution

by:
Dalin earned 100 total points
ID: 1438653
Try:
   qry.Movelast
   qry.MoveFirst
        For i = 1 To qry.RecordCount
            Print #1, fld.Value
            qry.MoveNext
        Next i
0
 
LVL 9

Expert Comment

by:Dalin
ID: 1438654
JasonBurt,
Recordcount is the count for the number of records you accessed, not the actual record number. To get the recordcount correctly, you need to move to the last.
Hope this help.
Regards
Dalin
0
 

Author Comment

by:JasonBurt
ID: 1438655
Thank you indeed.  And thanks for the explaination.  It works wonderfully.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to create a duplicate finder Application 9 122
Access query that references subform 5 47
SQL VB connection works in one PC and doesn't in another 15 67
Help me. 3 60
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question