VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Access Field Names

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
301 Views, 3 Replies

Access Field Names

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?
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Anonymous


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?
Message 3 of 4
fantum
in reply to: Anonymous

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
Message 4 of 4
Anonymous
in reply to: Anonymous

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost