Code to generate complex label

613
0
01-24-2011 10:39 AM
MarciaWilson
New Contributor
I???m fairly new to VBA, but I work with some macro-whizzes so I can get lots of help hammering out the details of code. However, they have no knowledge of GIS and I???m very new to the program (we have ArcGIS 10) myself. So I don???t know how things work and my questions are more about approach and limitations. It???s possible that I???m not even asking the right questions.

I have a layer of point data that links to a MS Access query. Each location has more than one record in the query. For example:
X....Y....LocationID....Depth....Parameter....Result
X_a....Y_a....A....???1-2???....Contam1....1.15
X_a....Y_a....A....???1-2???....Contam2....2.12
X_a....Y_a....A....???2-3???....Contam1....2.0
X_a....Y_a....A....???2-3???....Contam2....3.5
X_b....Y_b....B....???1.5-2???....Contam1....1
X_b....Y_b....B....???1.5-2???....Contam2....2
X_b....Y_b....B....???2-3.5???....Contam1....2
X_b....Y_b....B....???2-3.5???....Contam2....3

I want to create labels for each location that look something like:
LocationID
Depth1   Result_Contam1   Result_Contam2
Depth2   Result_Contam1   Result_Contam2

Obviously I need to use VBA to accomplish this task. I???m assuming that it will need to loop through all the records in the table. Would it be better to write the macro entirely in the label expression box? Or can I write labels by using a macro called from the main view?
If I write the macro in the label expression, do I need to call all the fields as inputs to the function, or will that return the values of only the first record that matches the location? If it???s the latter, can I first reference all the records and then call the fields in the table from within the code and if so what command would I use?

Thank you very much for your patience with me.

I have posted this question in the ???Editing??? forum as well. I wasn???t sure which forum was more appropriate. Let me know if this question doesn???t belong in this forum.
Tags (2)
0 Kudos
0 Replies