|
To Zoom in to an object in an access 2000 form i use the following. Dim M As New ComponentControl Set M = ActiveXCtl.Object Set comps = M.Document.ComponentSet Set dwg = comps("XYPoint") Set zoom = comps("PointExtent") Set os = dwg.ObjectSet Set extent = zoom.ObjectSet ' remove previous objects in sets os.RemoveAll extent.RemoveAll Set P = M.Application.NewPoint Set Px = M.Application.NewPoint P.X = Me.Easting ' from easting txt box on access form P.Y = Me.Northing ' from northing txt box on access form Set g = M.Application.NewGeom(GeomPoint, P) os.Add (g) ' this adds 500 m +/- to x,y point so that the map zooms into the point centred within a 1km view Px.X = Me.Easting + 500 Px.Y = Me.Northing + 500 Set gx = M.Application.NewGeom(GeomPoint, Px) extent.Add (gx) P.X = Me.Easting - 500 P.Y = Me.Northing - 500 Set gx = M.Application.NewGeom(GeomPoint, P) extent.Add (gx) M.Refresh M.ZoomTo (zoom) Set M = Nothing Set doc = Nothing Set comps = Nothing Set dwg = Nothing Set zoom = Nothing Set os = Nothing Set extent = Nothing I also use a drawing in the project called Scope which sets the bounds i want. To set the map to this rather than full extents i use .. Set mapscope = comps("Scope") ... M.ZoomTo (mapscope) I can get the map to zoom to objects in a database (in easting and northings fields) but hoping someone can shed some light on click events in access so i can add the coords from a click to the database.
|