DoCmd.RunSQL "INSERT INTO tbl_Coding ( Name ) SELECT 单位基本情况表.隶属地区 FROM 单位基本情况表 GROUP BY 单位基本情况表.隶属地区"
DoCmd.RunSQL "INSERT INTO tbl_Coding ( Name, ParentID ) SELECT 单位基本情况表.系统类别, tbl_Coding.ID FROM 单位基本情况表 INNER JOIN tbl_Coding ON 单位基本情况表.隶属地区 = tbl_Coding.Name GROUP BY 单位基本情况表.系统类别, tbl_Coding.ID"
DoCmd.RunSQL "INSERT INTO tbl_Coding ( Name, ParentID ) SELECT '领导班子' AS 1, tbl_Coding.ID FROM 单位基本情况表 INNER JOIN tbl_Coding ON 单位基本情况表.系统类别 = tbl_Coding.Name Group BY '领导班子', tbl_Coding.ID, tbl_Coding.Name HAVING (((tbl_Coding.Name)='党委系统')) OR (((tbl_Coding.Name)='政府系统')) OR (((tbl_Coding.Name)='人大')) OR (((tbl_Coding.Name)='政协'))"
DoCmd.RunSQL "INSERT INTO tbl_Coding ( Name, ParentID, px ) SELECT 单位基本情况表.单位名称, tbl_Coding.ID, 单位基本情况表.单位编号 FROM (单位基本情况表 INNER JOIN tbl_Coding ON 单位基本情况表.系统类别 = tbl_Coding.Name) INNER JOIN 区域名称 ON tbl_Coding.Name = 区域名称.隶属地区 GROUP BY 单位基本情况表.单位名称, tbl_Coding.ID, 单位基本情况表.单位编号"
DoCmd.OpenQuery "abcd"
DoCmd.OpenQuery "abcd2"
如何能将各省的单位在追加时只对应到自己的省下面!!!