Solved

Printing Values from a Query

Posted on 1998-10-07
3
119 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Pull multiple cvs files into one access table 28 68
Reading the Contents of a Directory In Access VBA 5 68
VBA filters 2 61
Convert VB6 MSXML2.ServerXMLHTTP process to C# 2 47
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

773 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