HasAtt...GetAtt directly to Recordset!Field...Huumm

HasAtt...GetAtt directly to Recordset!Field...Huumm

Anonymous
Not applicable
239 Views
6 Replies
Message 1 of 7

HasAtt...GetAtt directly to Recordset!Field...Huumm

Anonymous
Not applicable
I'm not having much luck declaring attribute values as Fields and passing
this variable has an ADODB Recordset Field. The attribute Tag is identical
to the Field name but the data type is not. The error is ..."expect
property not variable".
0 Likes
240 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable
Huh? Can you post a code fragment?
--
John Goodfellow
irtf'nm
use 'microtouch' in address to email

"Martin Autensmith" wrote in message
news:E80F003F36F6AF75B262B70DF1FBF3B5@in.WebX.maYIadrTaRb...
> I'm not having much luck declaring attribute values as Fields and passing
> this variable has an ADODB Recordset Field. The attribute Tag is
identical
> to the Field name but the data type is not. The error is ..."expect
> property not variable".
>
0 Likes
Message 3 of 7

Anonymous
Not applicable
Use the TagString property to look up the field and set the field's value using
the TextString property:

For i = LBound(atts) To UBound(atts)
rs!atts(i).TagString = atts(i).TextString
Next

--
http://www.acadx.com
Win a free autographed copy of
"AutoCAD 2000 VBA Programmer's Reference"

"Martin Autensmith" wrote in message
news:E80F003F36F6AF75B262B70DF1FBF3B5@in.WebX.maYIadrTaRb...
> I'm not having much luck declaring attribute values as Fields and passing
> this variable has an ADODB Recordset Field. The attribute Tag is identical
> to the Field name but the data type is not. The error is ..."expect
> property not variable".
>
0 Likes
Message 4 of 7

Anonymous
Not applicable
You may have to ask me some more rudimentary questions--"Huum" is a good
start. I'm not up one exactly what the "blkTmp As AcadBlockReference" is
all about. I'll try to work some of the code Frank posted and maybe refine
my prior posting

If blkTmp.HasAttributes Then
atts = blkTmp.GetAttributes
For j = LBound(atts) To UBound(atts)
strField = atts(j).TagString
strValue = atts(j).TextString
Next
End If

"John Goodfellow" wrote in message
news:448FA5802E979F9F2308A8D25F66DE10@in.WebX.maYIadrTaRb...
> Huh? Can you post a code fragment?
> --
> John Goodfellow
> irtf'nm
> use 'microtouch' in address to email
>
> "Martin Autensmith" wrote in message
> news:E80F003F36F6AF75B262B70DF1FBF3B5@in.WebX.maYIadrTaRb...
> > I'm not having much luck declaring attribute values as Fields and
passing
> > this variable has an ADODB Recordset Field. The attribute Tag is
> identical
> > to the Field name but the data type is not. The error is ..."expect
> > property not variable".
> >
>
0 Likes
Message 5 of 7

Anonymous
Not applicable
I think I may have boogied a reply.

If the code you (Frank) posted, is correlating acadblockreference collection
with recordset properties of type and name, this is how it should be. I'll
give it another wrack!

"Frank Oquendo" wrote in message
news:D838438A0F397495ABA07425C3D01676@in.WebX.maYIadrTaRb...
> Use the TagString property to look up the field and set the field's value
using
> the TextString property:
>
> For i = LBound(atts) To UBound(atts)
> rs!atts(i).TagString = atts(i).TextString
> Next
>
> --
> http://www.acadx.com
> Win a free autographed copy of
> "AutoCAD 2000 VBA Programmer's Reference"
>
> "Martin Autensmith" wrote in message
> news:E80F003F36F6AF75B262B70DF1FBF3B5@in.WebX.maYIadrTaRb...
> > I'm not having much luck declaring attribute values as Fields and
passing
> > this variable has an ADODB Recordset Field. The attribute Tag is
identical
> > to the Field name but the data type is not. The error is ..."expect
> > property not variable".
> >
>
0 Likes
Message 6 of 7

Anonymous
Not applicable
Don't assume too much. The code I posted is the vary *last* step involved. In
addition, blocks and recordsets have nothing to do with one another. The loop
assumes that you have a recordset whose fields collection matches the attributes
in your block(s).

There's quite a bit of work involved in getting to the point where you can start
storing attribute values into your database.

--
http://www.acadx.com
Win a free autographed copy of
"AutoCAD 2000 VBA Programmer's Reference"

"Martin Autensmith" wrote in message
news:BAECC1B5A23D906C851C0F1E1811848E@in.WebX.maYIadrTaRb...
> I think I may have boogied a reply.
>
> If the code you (Frank) posted, is correlating acadblockreference collection
> with recordset properties of type and name, this is how it should be. I'll
> give it another wrack!
0 Likes
Message 7 of 7

Anonymous
Not applicable
Martin,

I have not tested this code, but see if it makes sense. Then ask again.

John

Dim oBlkRef As AcadBlockReference ' Block Reference that has
attributes
Dim vAttObjArr As Variant ' array of AttributeReference
objects
Dim oAttRef As AcadAttributeReference ' single AttributeReference object
Dim strAttTag As String ' AttributeReference TagString prop
(aka field name)
Dim strAttTxt As String ' AttributeReference TextString prop
(aka field value)
Dim i As Integer ' loop counter
Dim oRSet As ADODB.Recordset ' ADO RecordSet object
Dim oField As ADODB.Field ' ADO Field object

' get or make the RecordSet object here
' get the block ref that has attributes here

vAttObjArr = oBlkRef.GetAttributes() ' get attribute refs from block ref
For i = LBound(vAttObjArr) To UBound(vAttObjArr) ' for each attribute ref
oAttRef = vAttObjArr(i) ' get one attribute ref
strAttTag = oAttRef.TagString ' read its TagString (aka field
name)
strAttTxt = oAttRef.TextString ' read its TextString (aka field
value)
Set oField = oRSet.Fields.item(strAttTag) ' get the RecordSet
Field with the same name
Select Case oField.Type ' match attribute data type to field
data type
Case adChar ' field is character data type (VB
DataTypeEnum)
oField.Value = strAttTxt ' assign attribute value to field
value directly
Case adDouble ' field is double-prec. floating
point data type
oField.Value = CDbl(strAttTxt) ' assign with type conversion
string-to-double
Case adInteger ' field is integer
oField.Value = CInt(strAttTxt) ' assign with type conversion
string-to-integer
End Select
Next i

--
John Goodfellow
irtf'nm
use 'microtouch' in address to email

"Martin Autensmith" wrote in message
news:9E716712B7BDC76099515E3630455444@in.WebX.maYIadrTaRb...
> You may have to ask me some more rudimentary questions--"Huum" is a good
> start. I'm not up one exactly what the "blkTmp As AcadBlockReference" is
> all about. I'll try to work some of the code Frank posted and maybe refine
> my prior posting
>
> If blkTmp.HasAttributes Then
> atts = blkTmp.GetAttributes
> For j = LBound(atts) To UBound(atts)
> strField = atts(j).TagString
> strValue = atts(j).TextString
> Next
> End If
>
> "John Goodfellow" wrote in message
> news:448FA5802E979F9F2308A8D25F66DE10@in.WebX.maYIadrTaRb...
> > Huh? Can you post a code fragment?
> > --
> > John Goodfellow
> > irtf'nm
> > use 'microtouch' in address to email
> >
> > "Martin Autensmith" wrote in
message
> > news:E80F003F36F6AF75B262B70DF1FBF3B5@in.WebX.maYIadrTaRb...
> > > I'm not having much luck declaring attribute values as Fields and
> passing
> > > this variable has an ADODB Recordset Field. The attribute Tag is
> > identical
> > > to the Field name but the data type is not. The error is ..."expect
> > > property not variable".
> > >
> >
>
0 Likes