473,769 Members | 2,091 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1944
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.OpenRecordse t("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
2243
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 me to change the data when I hit the submit button. Blogs are displayed as links to image.php?id=$id along with browse buttons so new images can be uploaded. The idea is to make an idiot proof way for artists to change their web databases without...
34
4234
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
1693
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 colleague did, got an unexpected result, and asked me why. I think I can infer what is occurring, and I was able to find a simple work-around. But I thought I'd ask about it anyway. I've been pushing Python at work for use as a scripting...
2
7976
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 date fields in my SELECT statement, but Execute does not like it. I tried different variations, none of them works :(
1
2074
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. I have values in the datatable like this:
6
6058
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 try to modify the objects in the array while iterating through it. I marked the bugs in this code: // Loop through all previously added accounts foreach(Account a in a1) // a1 is an ArrayList { // If name and context is the same if(a.Name ==...
10
15145
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 that object. Occaisionally however I need to run a method on every object in the hashtable. I've done both For..Each and iEnumeratior loops. The messy part is that under certain conditions, while iterating, a condition exists where I need to remove...
1
1450
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 iterating through the set, e.g., to create an HTML table of the data? Should I be thinking foreach() or something else?
4
2822
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 great deal of help from gits, I've developed a DOM creation and deletion script, which can be used in multiple applications. You simply feed the script a JSON list of any size, and the script will create multiple DOM elements with as many attributes...
0
9579
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9422
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10208
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9987
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9857
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8867
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7404
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6662
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
3
2812
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.