Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set a field name as a variable

Status
Not open for further replies.

Razor1

IS-IT--Management
Nov 21, 2002
81
US
I create field names in a table based on an entry form, the field names can change every time the program is run. I need to place data in a field whos name changes everytime the program is run.
Basically what I want to do is assign a variable for a field name and then write to that field.

example:

rstanyfile.add new
rst_anyfile!data1 = Test1
rstanyfile.update

I want to make this field rst_anyfile!data1 change based on specfic conditions.
Any help would be greatly appreciated.

Razor1
 
Dynamically changing field names makes no sense to me. I cannot imagine any logical condition where you would want to do this. However, use "Dot" notation.

dim x as string
x = "someFieldName"
rstanyfile.addnew
rst_anyFile.fields(x) = "some value"
rstanyfile.update
 
I would go a step (or several) beyond
MajP said:
" ... makes no sense to ...". It is quite contrary to basic database normalization.



MichaelRed
 
I've heard of dealing with field name changes when you dealing with some upload from another organization, but changing them on the fly ? Dude......
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top