Access table -> MI table has two ways:
1. Bindlayerxy mode binding. Specify Bindlayer.Filespec to create a permanent table, not specifying a temporary table. Private submmand4_click () 'can only create a field, Geoname, from the City field. When the city field is unique, the State field is used to limit.
'Not create an index Dim BindlayerObject As New mapxlib.BindLayerDim db As DAO.DatabaseDim rs As DAO.RecordsetDim ds As mapxlib.DatasetSet db = DBEngine.WorkSpaces (0) .Opendatabase ( "C: / Program Files / MapInfo / MapX 4.0 / Data /Mapstats.mdb")set = DB.OpenRecordset ("US_CUST") BindlayerObject.LayerName = "New Layer Name" BindlayerObject.filespec = app.path "/mytab.tab" is a temporary table if not specified BindlayerObject.RefColumn1 = "X" BindlayerObject.RefColumn2 = "Y" BindlayerObject.LayerType = miBindLayerTypeXYSet ds = Map1.Datasets.Add (miDataSetDAO, rs, "dataset name", "City", "State", BindlayerObject) End Sub2. LayerInfo New Table Layers.add Lyrinfo Create a hollow table DS.RowValues with full field, lyr.addfeature ftr, RVS fill in the primitives and attributes, can create multiple fields' MAPX5 can create an index, in mapx4 not Dim rs As DAO.RecordsetDim db As DAO.DatabaseDim flds As New MapXLib.FieldsDim lyrNew As MapXLib.LayerDim ptNew As New MapXLib.PointDim ftrNew As MapXLib.FeatureDim ff As MapXLib.FeatureFactoryDim li As New MapXLib.LayerInfoDim rvs As New Mapxlib.rowValuesdim DS as Mapxlib.DataSetSet DB = DBENGINE .OpenDatabase ( "C: / Program Files / MapInfo / MapX 4.0 / data / mapstats.mdb") Set rs = db.OpenRecordset ( "US_Cust") Set ff = Map1.FeatureFactoryflds.AddStringField "Company", 50, true 'mapx5 You can create an index, 'flds.AddStringField "Company", 50' mapx4 not create the index, flds.AddStringField "City", 50flds.AddStringField "State", 2flds.AddNumericField "Order_Amt", 12, 2li.Type = miLayerInfoTypeNewTableli .Addparameter "filespec", app.path & "/custtab.tab"li.addparameter" name "," Mycustomers "li.addparameter"
Fields ", FLDSMAP1.LAYERS.ADD Li, 1 'to this, have been built with the Access table, and the field is also set, but there is no primitive on top, and there is no record.' The following is from the Access table x, Y creates a point charter, and add its attribute data into in '-------------------------------- --------------------------------- set lyrnew = map1.layers (1) set ds = map1.datasets.add (Midatasetlayer, Lyrnew) SET RVS = ds.rowvalues (0) rs.movefirstdo while not rs.eofrvs.Item ("Company"). Value = rs.fields ("Company") 'RVS.Item ("Company") Written as RVS ("Company") RVS.Item ("city"). Value = rs.fields ("city") RVS.Item ("State"). Value = rs.fields ("State") RVS.Item "ORDER_AMT"). Value = rs.fields ("ORDER_AMT") Ptnew.Set Rs.fields ("x"), RS.Fields ("Y") set ftrnew = ff.createSymbol (Ptnew) set ftrnew = lyrnew.addfeature (FTRNEW, RVS) 'Charity Properties, FEATURE ROWVALUES'SET FTRNEW = lyw.addfeature (ftrnew)' ftrnew.Update true, rvsrs.movenextLoopset RS = NothingSet DB = Nothingend Sub ========= ========= Mapx expert forum (www.51gis.com) ===================