|
本帖最后由 todaynew 于 2010-9-13 13:54 编辑
回复
这种办法试过,但如何解决重复项信息?查询重复项,再删除?想做个按钮,一次搞定!指教帮助一下!
...
程研 发表于 2010-9-13 12:06
Sub MyInsert(tbname as string,Stbname as string,SPath as string,WH as string)
'功能:将外部表数据追加到目标表中
'参数: tbname--目标表名称字符串
' Stbname--源表名称字符串
' Spath--原表所在数据库完成文件名(含路径)
' WH--两表比较字数串
'示例: MyInsert "学生表","学生资料","F:\成绩管理系统.mdb","b.姓名=a.姓名 and b.性别=a.性别"
dim ssql as string
ssql="INSERT INTO " & tbname
ssql=ssql & " select * from " & stbname & " as a"
ssql=ssql & " in " & Spath
ssql=ssql & " where not EXISTS (select * from " & tbname & " as b where " & WH & " )"
docmd.runsql ssql
end sub
|
|