Select to view content in your preferred language

VBA Coding for Selected features

983
4
12-16-2010 06:30 AM
AdamOller
Emerging Contributor
I've developed the following form and it has all of the possible field attributes that could be selected to identify one single unique attribute. I want to be able to select all three and choose "calculate" to provide a message box that will give the unique attribute. My coding abilities are limited to the Getting to Know ArcObjects book which has helped me greatly in creating this form and adding all of the items in the drop down menus.

Thanks!

aoller1
SIUC Graduate Assistant
0 Kudos
4 Replies
AdamOller
Emerging Contributor
It would probably would not hurt to elaborate on my need(s). When looking at the attached pdf, I want to be able to select 2000 (year), 1 (route #), and house sparrow (species) and then click calculate to pop up a message box that will tell me the number of species found for that route and time year. Each selection no matter the combination will have one single unique attribute. All of this information is found in the same shapefile/attribute table. I was thinking maybe some sort of TableLookUp but reading about it on Developer Help led me to believing that was not the right choice.
0 Kudos
JeffreyHamblin
Occasional Contributor
Hi Adam,

My question is: if you want "the number of species found for that route and time year" -- why would you have the user select a species? Wouldn't you just have them select a route and year, and then count the number of species?

Or do you actually want to calculate the count of individuals of a particular species? Is there a fourth field for that in the table?

-Jeff
0 Kudos
AdamOller
Emerging Contributor
Hi Adam,

My question is: if you want "the number of species found for that route and time year" -- why would you have the user select a species? Wouldn't you just have them select a route and year, and then count the number of species?

Or do you actually want to calculate the count of individuals of a particular species? Is there a fourth field for that in the table?

-Jeff


Yes, there are four different species and there is a fourth field that has total number of species that has a particular year, route, and species ID associated with it in the row itself.
0 Kudos
JeffreyHamblin
Occasional Contributor
Yes, there are four different species and there is a fourth field that has total number of species that has a particular year, route, and species ID associated with it in the row itself.


Oh, I see, you're not actually calculating the value -- you just need to return it from a single field.

One way to do that would be to use either an IFeatureClass.Search or an IFeatureLayer.Search, and pass in an IQueryFilter with its WhereClause set to the fields and values for your three parameters. From the cursor returned from that, get the value of your fourth field.

Here's the WhereClause reference to get you started.

-Jeff
0 Kudos