Solved

Printing Values from a Query

Posted on 1998-10-07
3
123 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

696 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