5 Combobox to Select By Attributes From Joined Table

543
3
05-07-2013 06:56 AM
geomatic
New Contributor
Hi Experts,

I created 6 combobox including attributes of joined data. I want to make a query like "select by attribute" by using the comboboxes.

I used many of the sample codes but I got some errors.

Can you help me about finding solutions to write a codes for querying like select by attribute function?

Note: I have another userform to select by attributes by using one of the fields on same layer.

I just want to use AND function to select attributes and in sixth combobox will choose null values or others to zoom after five combobox's choosen data.

I hope i would be clear enough.

Kindly Regards.
0 Kudos
3 Replies
deleted-user-VeC5jUIlNXtq
Occasional Contributor III
Hi,

I recently developed a little application for our department that allows them to type in textboxes which then goes to the attribute table and selects.

here's a quick sample (bear with me, I picked apart the code and omitted a bunch of unnecessary lines):

' Create the query filter using user input.
        Dim pQueryFilter As IQueryFilter
        Dim pFeatureSelection As IFeatureSelection

        pQueryFilter = New QueryFilter

        pQueryFilter.WhereClause = "SEC = '" & sSEC & "'" & " AND TWP = '" & sTWP & "'" & " AND RGE = '" & sRGE & "'" & " AND MER = '" & sMER & "'"

        pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, Nothing, Nothing)
        ' Perform the selection using the user input.
        pFeatureSelection.SelectFeatures(pQueryFilter, esriSelectionResultEnum.esriSelectionResultNew, False)


This will obviously be needing modification to suit your code/attributes. The only thing I left out, is that you need to set the pFeatureSelection to the feature layer you're selecting attributes from (pFeatureSelection = pFeatureLayer).

Mine basically says where field "SEC" is equal to the string "sSec" which I get from Me.txtbox_Sec.Text, and so on.

I hope this gives you at least a little help. It's a very simple query, but works for me.
0 Kudos
deleted-user-VeC5jUIlNXtq
Occasional Contributor III
I should simplify as well, in case my code isn't working for you.

Step 1. Try getting the text from the combo boxes into strings.

Step 2. Use those strings as the conditions for the Selection query.

I'm interested to see if it works, so I'll check back when you reply 🙂
0 Kudos
geomatic
New Contributor
Hi,

I want to make a query including some comboboxes.
I want to show count of objects matches attributes between two values.
For instance;

I want to show count of houses by using rent values between 21 and 55.

first combobox to select small value, secont to select bigger value.

and finally i have two layers, both of the layers should have two comboboxes and two count values.

I hope it would be clear to understand my needs.

Kindly Regards.
0 Kudos