[AccessD] Put fieldname into a variable

Drew Wutka DWUTKA at marlow.com
Thu Oct 23 12:50:57 CDT 2003


What you want is the Name property.

Dim i as Long
Dim strName as string
Dim rs as Recordset
'Recordset code....
Do until rs.EOF=True
	for i=1 to rs.Fields.Count
		strName=rs.Fields(i).Name
		'Process code..
	Next i
	rs.MoveNext
Loop
rs.close
Set rs=nothing

Drew

-----Original Message-----
From: Mark Boyd [mailto:MarkBoyd at mcbeeassociates.com]
Sent: Thursday, October 23, 2003 12:28 PM
To: AccessD at databaseadvisors.com
Subject: [AccessD] Put fieldname into a variable


I would like to put a table's fieldname into a variable, and run code
like the following:

(I've omitted most of the code because of space)

Dim fld as Field

Dim i as Integer

 

Do until rst.EOF = True

     i = i + 1

     fld = rst![Field" & i & "]

     ... do processing

Loop

 

Any ideas how this can be done?

 

Mark Boyd

Sr. Systems Analyst

McBee Associates, Inc.

 

_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


More information about the AccessD mailing list