Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Query two at a time in a recordset

Posted on 2006-11-14
3
Medium Priority
?
154 Views
Last Modified: 2010-04-30
I am trying to retrieve records in my Access database.  I use the following code to retrieve records and place them in text fields.  However, I only allow two text boxes on my form and the results from my query are definitely more than two.  So I need to be able to collect two records at a time in a record set until I finish modifying the data in the that record set.  

How do I write the code to input the two values at a time from the queried recordset into Text1 and Text2?

esql = "select * from frm2SectionI where ID =" & Text1
        rec.Open (esql), conn, adOpenDynamic, adLockOptimistic
       
 

        Text1 = rec.Fields(1)
        Text2 = rec.Fields(2)


       
        If Not rec.EOF Then rec.MoveNext
        rec.Close
0
Comment
Question by:al4629740
[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 35

Accepted Solution

by:
Raynard7 earned 2000 total points
ID: 17943457
why can't you do

esql = "select * from frm2SectionI where ID =" & Text1
        rec.Open (esql), conn, adOpenDynamic, adLockOptimistic
if not rec.EOF = roc.BOF and rec.EOF = false then
        Text1 = rec.Fields(1)
        rec.MoveNext
end if
if not rec.EOF = roc.BOF and rec.EOF = false then
        Text2 = rec.Fields(1)
end if
rec.Close

look at the first record - then look at the second, put the first in the first box, the second in the second box
0
 

Author Comment

by:al4629740
ID: 17943513
What if I want to go backwards in the same record set.  Maybe I am on record 7 and 8, but i want to go back to record 5 and 6?
0
 
LVL 35

Expert Comment

by:Raynard7
ID: 17943531
why can't you use

rec.moveprevious

to move backwards?
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
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…
Suggested Courses

715 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