473,387 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Iterating a table with VB


I have a table with no ID field. I would like to read a single field
of each record using DLookup or something similar and pass it to a VB
function that's already been written. However, DLookup doesn't seem to
be able to "index" a table, but rather returns a field based on some
matching criteria.

What's the simplest way to iterate a table like I need to do in VB? My
VB skills are mediocre and my SQL skills are even worse, so if it's
doable in VB, that might be the best way for me. I don't care how long
the operation takes.

Thanks,
Rich

Nov 13 '05 #1
2 1927
rc*****@comcast.net wrote:
I have a table with no ID field. I would like to read a single field
of each record using DLookup or something similar and pass it to a VB
function that's already been written. However, DLookup doesn't seem
to be able to "index" a table, but rather returns a field based on
some matching criteria.

What's the simplest way to iterate a table like I need to do in VB?
My VB skills are mediocre and my SQL skills are even worse, so if it's
doable in VB, that might be the best way for me. I don't care how
long the operation takes.

Thanks,
Rich


What is the function going to do? Are you sure it can't be done with a query?
Iterating through a table is seldom necessary, but to do so you would create a
RecordSet and loop through it in code.

Dim db As Database
Dim rs As Recordset

Set db = CurrentDB
Set rs = db.OpenRecordset("TableName")

Do Until rs.EOF
YourFunction(rs!FieldName)
rs.MoveNext
Loop
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 13 '05 #2
Thanks Rick.

I'm sure it could be done with a Query. I'm just more comfortable with
VB and don't have the time to get more up to speed on SQL just yet.
Someday....

Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: red | last post by:
I'm probably crazy for even trying this but I'm trying to make a script that will iterate through my databases, iterate through all the tables, and show everything on one page in forms that allow...
34
by: Christopher Benson-Manica | last post by:
If an array is sparse, say something like var foo=; foo=4; foo='baz'; foo='moo'; is there a way to iterate through the entire array? --
7
by: Dave Hansen | last post by:
OK, first, I don't often have the time to read this group, so apologies if this is a FAQ, though I couldn't find anything at python.org. Second, this isn't my code. I wouldn't do this. But a...
2
by: Rhanda Zak | last post by:
Hi NG! I just managed copying data from one table to another table (boah, what a big deal :). But there are still some problems: 1) I want to use the keyword "BETWEEN" in combination with...
1
by: bdwise | last post by:
I have a hash table with key/value like this: aaaa 1 aa 2 bbbb 3 I am iterating over a datatable and trying to search and replace values in it based on a match in the hashtable. ...
6
by: Gustaf Liljegren | last post by:
I ran into this problem today: I got an array with Account objects. I need to iterate through this array to supplement the accounts in the array with more data. But the compiler complains when I...
10
by: Ken Foster | last post by:
I have a hashtable keyed by some name, holding an instance of an object. Most of the time I use the hashtable in the traditional sense, given a name, I lookup the object, then I run a method on...
1
by: john | last post by:
All: I'm using MDB2 to pull data from a MySQL database... works fine, e.g.: $result = getData(...); Now that I have the $result (a multidimensional array), what is the PHP idiom for...
4
RMWChaos
by: RMWChaos | last post by:
The next episode in the continuing saga of trying to develop a modular, automated DOM create and remove script asks the question, "Where should I put this code?" Alright, here's the story: with a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.