zoom to polygon on Microsoft Access report

423
3
04-11-2011 05:34 AM
PhillipDavis2
New Contributor
I have searched for a solution but don't seem to be able to find one on this forum (Apologies if I have over looked a post).

I have an access report that is based on information within a personal geodatabase, using two fields within a polygon feature to identify each area. On the report is a MapControl Object that I'm attempting to have refresh for each page to show the unique area that the report is concentrating on.

I have tried numerous pieces of code but non have been successful. I have "Getting to know ArcObjects" but struggle to follow the section on making dynamic layouts.

Any pointers, or example code to help would be very useful as my current code runs into a 'Run-time error '-2147467259 (80004005)': Data type mismatch in criteria expression." at
Set ss = FC.Select(iq, esriSelectionTypeIDSet, esriSelectionOptionNormal, Nothing)

I've included a text file of the code if this helps at all. I am open to a complete re-write. I feel this should be much much easier than I'm making it.

Thank you.
0 Kudos
3 Replies
JamesCrandall
MVP Frequent Contributor
Are you sure "Sect" in your WHERE clause is of type numeric?

iq.WhereClause = "[Branch]='" & Bran & "' AND [Section_]=" & Sect


If it is a string type then you'd need to add single quotes around it like you have done wiht "[Branc]".  Something like:

iq.WhereClause = "[Branch]='" & Bran & "' AND [Section_]='" & Sect &'"
0 Kudos
PhillipDavis2
New Contributor
Thank you very very much James,

I've been stressing and pulling my hair out for weeks trying to figure this out and all along it was the simplest of problems.

I can't thank you enough for your speedy and fantastic reply everything works perfectly now!
0 Kudos
JamesCrandall
MVP Frequent Contributor
Thank you very very much James,

I've been stressing and pulling my hair out for weeks trying to figure this out and all along it was the simplest of problems.

I can't thank you enough for your speedy and fantastic reply everything works perfectly now!


Great!  Glad it helped out!

james
0 Kudos