AutoCAD Map 3D Developer
Welcome to Autodesk’s AutoCAD Map 3D Developer Forums. Share your knowledge, ask questions, and explore popular AutoCAD Map 3D Developer topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Data Condition Query Difficulty

1 REPLY 1
Reply
Message 1 of 2
Anonymous
225 Views, 1 Reply

Data Condition Query Difficulty

Hello All,

I am having difficulty with a query leaf accepting a string variable. I have
a project that attaches a drawing containing section lines. Each object has
an object data table with the section number. I desire to allow the user to
select a section name from a drop down list, and use a data condition to
look for that section. I pass the section name into the routine, attach the
drawing, but when I use the boolean variable IsSuccess to query the
information, the VBA routine errors on me. In debugging, I replace the
section name passed with a pure string like this:

IsSuccess = objQLeaf.SetDataCond(kDataIRD, kCondEq, "SECTIONS",
"SECTION", "1n1e10")

and it works perfectly.But when I replace the "1n1e10" with a variable
strSection like this

IsSuccess = objQLeaf.SetDataCond(kDataIRD, kCondEq, "SECTIONS",
"SECTION", strSection)

I receive a run time error, "invalid procedural call or arguement", even
though strSection is declared as a string and contains a value "1n1e10". I
am not sure how to deal with this, and would greatly appreciate help.

Mike Killion
1 REPLY 1
Message 2 of 2
Anonymous
in reply to: Anonymous

I have found that the built in function SetDataCond does not define the
parameter vValue of any particular type. I have tried to pass a variant and
a string without any success. Here is the code:

Public Sub SectionQuery(vList As Variant)
'The next two items are public variables
Set objAMap =
ThisDrawing.Application.GetInterfaceObject("AutoCADMap.Application")
Set objProjects = objAMap.Projects

Dim objAcadMapAliases As Object
Dim objAcadMapAlias As Object

Set objAD = objProjects(0).DrawingSet.Add("F:\\AUTO\TAXLOTS.dwg")
Set qryMap = objProjects(0).CurrQuery
qryMap.Clear
qryMap.Mode = kQueryDraw
vSection = vList
Set objQBranch = qryMap.QueryBranch 'get ahold of the main branch

Set objQLeaf = objQBranch.Add(kDataCondition, kOperatorAnd)
IsSuccess = objQLeaf.SetDataCond(kDataIRD, kCondEq, "SECTIONS",
"SECTION", vList)

On this final line, the error is "Run time error '5', Invalid procedure call
or argument". Not sure if this is significant, but at the time of the error,
vSection is listed with Type "Variant/String".

I am hoping one of you can give this a look and at least pitch your two
cents at me.

Mike
"Michael Killion" wrote in message
news:5312201@discussion.autodesk.com...
Hello All,

I am having difficulty with a query leaf accepting a string variable. I have
a project that attaches a drawing containing section lines. Each object has
an object data table with the section number. I desire to allow the user to
select a section name from a drop down list, and use a data condition to
look for that section. I pass the section name into the routine, attach the
drawing, but when I use the boolean variable IsSuccess to query the
information, the VBA routine errors on me. In debugging, I replace the
section name passed with a pure string like this:

IsSuccess = objQLeaf.SetDataCond(kDataIRD, kCondEq, "SECTIONS",
"SECTION", "1n1e10")

and it works perfectly.But when I replace the "1n1e10" with a variable
strSection like this

IsSuccess = objQLeaf.SetDataCond(kDataIRD, kCondEq, "SECTIONS",
"SECTION", strSection)

I receive a run time error, "invalid procedural call or arguement", even
though strSection is declared as a string and contains a value "1n1e10". I
am not sure how to deal with this, and would greatly appreciate help.

Mike Killion

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

Post to forums  

Autodesk Design & Make Report

”Boost