Access Field Names

Access Field Names

Anonymous
Not applicable
472 Views
3 Replies
Message 1 of 4

Access Field Names

Anonymous
Not applicable
I am grabbing values from specific Access fields and storing them in a variable. If I type in strValue = !Panel it will grab the current record value for the Panel field and store it correctly to strValue.

If I cycle thru the field names by initially storing them as an array then strValue = "!Panel" will literally equal !Panel, obviously because it is recognizing it as a text string and not a field name. Does anyone know how to convert my field name that is stored in an array to be called on and recognized as an Access field name?
0 Likes
473 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable

Sorry, you are going to have to post some code
because we have to see your technique for accessing the database and creating a
recordset of the data.

 

Joe ...

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
I
am grabbing values from specific Access fields and storing them in a variable.
If I type in strValue = !Panel it will grab the current record value for the
Panel field and store it correctly to strValue. If I cycle thru the field
names by initially storing them as an array then strValue = "!Panel" will
literally equal !Panel, obviously because it is recognizing it as a text
string and not a field name. Does anyone know how to convert my field name
that is stored in an array to be called on and recognized as an Access field
name?
0 Likes
Message 3 of 4

Anonymous
Not applicable
If you have something like:

strValue = RS.Fields!Panel

you can change it to something like:

strName(0) = "Panel"
strValue = RS.Fields.Item(strName(0)).Value
0 Likes
Message 4 of 4

Anonymous
Not applicable
Thanks for the responses. I used the for each statement to cycle thru the fields til I matched the one I needed.

For Each oField In objRecordset.Fields
0 Likes