[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Help with loop

Posted on 1998-08-19
4
Medium Priority
?
135 Views
Last Modified: 2010-04-30
VB5  f= MSFlexgrid, rs = DAO recordset
Following loop is not looping it returns only last record in
the recordset and places it in the grid.
///
Do Until rs.EOF
str = ""
For i = 0 To rs.Fields.Count - 1
str = str & rs.Fields(i).Value & vbTab
Next i
f.AddItem str
rs.MoveNext
Loop
///
anu help appreciated
0
Comment
Question by:mativare
[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
4 Comments
 
LVL 4

Expert Comment

by:mcix
ID: 1429954
Code looks OK...


1. Set a break point on str = ""
2. Insert a Debug.Print before Next i
3. Run (F5)
4. Step through the code using the F8 Key
5. After executing the Debug.Print, check the intermediate window CTRL G

You should see the value of str in that window.
You are checking to make sure your record set is there...

0
 
LVL 4

Expert Comment

by:mcix
ID: 1429955
Code looks OK...


1. Set a break point on str = ""
2. Insert a Debug.Print before Next i
3. Run (F5)
4. Step through the code using the F8 Key
5. After executing the Debug.Print, check the intermediate window CTRL G

You should see the value of str in that window.
You are checking to make sure your record set is there...

0
 
LVL 2

Expert Comment

by:richtsteig
ID: 1429956
I hope you just forgot to post the rs.movefirst?!
0
 
LVL 1

Accepted Solution

by:
blwatkins earned 200 total points
ID: 1429957
Place a RS.MoveLast and a RS.MoveFirst before your "Do Until" statement.
this will but you at the begining of your recordset.

Then do a little test to see how many records are in your recordset, to make sure you have more than one record.
Right after the above command put this:
  Msgbox ("Number of Records: " & rs.recordcount)

This will show you the number of records in your recordset.

I have the feeling you only have one record in your recordset.

The rest of your code looks fine.


0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Suggested Courses

649 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