UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Loop through table fields    
 
   
rost_b
post May 9 2004, 01:10 PM
Post #1

UtterAccess Enthusiast
Posts: 78



Hi. Trying to find how to do something like this:

for each Field in Table
if Field.Name = myName then
Field.Value = "Example"
end if
next

How do I go about it? Thanks.
Go to the top of the page
 
+
treeless
post May 9 2004, 01:18 PM
Post #2

UtterAccess Guru
Posts: 960
From: Yuma, AZ



Is this just one table, or a number of tables?

Hopefully, it is just one, and you can use the query builder to build an update query to update all values in the myName field to "Example"
Go to the top of the page
 
+
rost_b
post May 9 2004, 01:24 PM
Post #3

UtterAccess Enthusiast
Posts: 78



It is one table. But the issue is not in updating values. I'm struggling with looping through field names in any given table.
Go to the top of the page
 
+
xteam
post May 9 2004, 01:28 PM
Post #4

UtterAccess VIP
Posts: 3,667
From: Toronto, ON



Dim fldItem
Dim rst as recordset

Set rst = CurrentDb.OpenRecordset("YourTable",dbOpenDynaset)

' here assuming you moved to desired record in your recordset

For Each fldItem In rst.Fields
If fldPO.Name = myName Then
rst.Edit
rst(fldItem.Name) = "Example"
rst.Update
Endif

Next
Go to the top of the page
 
+
rost_b
post May 10 2004, 07:00 PM
Post #5

UtterAccess Enthusiast
Posts: 78



Thanks a lot, xteam.
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 18th May 2013 - 10:58 AM