在ACCESS数据库中,怎样把一个表的某些字段的某些记录复制到另一个表
在ACCESS数据库中,怎样把一个表的某些字段的某些记录复制到另一个表比如查找表中包含“中”的所有数据,兵把他复制下来...
在ACCESS数据库中,怎样把一个表的某些字段的某些记录复制到另一个表
比如查找表中包含“中”的所有数据,兵把他复制下来 展开
比如查找表中包含“中”的所有数据,兵把他复制下来 展开
3个回答
展开全部
可先用数据管道在PB中建立(或导入到)一个数据库,在通过数据窗口保存为你想要的任何格式的文件包括excel
String ls_File, ls_Path, ls_Ext
Integer li_Value
li_Value = GetFileSaveName ("打印到文件", ls_Path, ls_File, "DOC", &
"文本文件; (*.CSV), *.CVS," + &
"文本文件Tab (*.TXT), *.TXT," + &
"dBASE II (*.DBF), *.DBF," + &
"dBASE III (*.DBF), *.DBF," + &
"DIF文件 (*.DIF), *.DIF," + &
"Excel文件 (*.XLS), *.XLS," + &
"HTML文件 (*.HTM), *.HTM," + &
"PSR文件 (*.PSR), *.PSR," + &
"SQL文件 (*.SQL), *.SQL," + &
"多格式文件 (*.SYL), *.SYL," + &
"Lotus1-2-3 (*.WKS), *.WKS," + &
"Lotus1-2-3 (*.WK1), *.WK1," + &
"WMF Windows (*.WMF), *.WMF")
IF li_Value <> 1 THEN RETURN
IF ls_Path = '' THEN RETURN
IF FileExists(ls_Path) THEN
Beep(3)
IF MessageBox('系统信息', '文件:'+ls_Path+'已存在, 覆盖吗(Yes/No)?', Question!, YesNo!, 2)=2 THEN RETURN
END IF
ls_Ext = Upper(Right(ls_Path, 3))
CHOOSE CASE ls_Ext
// CASE "prn"
// dw_preview.Object.Datawindow.Print.FileName = ls_Path
// dw_preview.Print()
CASE 'CSV'
li_Value = dw_preview.SaveAs(ls_Path, CSV!, FALSE)
CASE 'DBF'
li_Value = dw_preview.SaveAs(ls_Path, dBASE3!, FALSE)
CASE 'DIF'
li_Value = dw_preview.SaveAs(ls_Path, DIF!, FALSE)
CASE 'XLS'
li_Value = dw_preview.SaveAs(ls_Path, Excel!, FALSE)
CASE 'HTM'
li_Value = dw_preview.SaveAs(ls_Path, HTMLTable!, FALSE)
CASE 'PSR'
li_Value = dw_preview.SaveAs(ls_Path, PSReport!, FALSE)
CASE 'SQL'
li_Value = dw_preview.SaveAs(ls_Path, SQLInsert!, FALSE)
CASE 'SYL'
li_Value = dw_preview.SaveAs(ls_Path, SYLK!, FALSE)
CASE 'TXT'
li_Value = dw_preview.SaveAs(ls_Path, Text!, FALSE)
CASE 'WKS'
li_Value = dw_preview.SaveAs(ls_Path, WKS!, FALSE)
CASE 'WK1'
li_Value = dw_preview.SaveAs(ls_Path, WK1!, FALSE)
CASE 'WMF'
li_Value = dw_preview.SaveAs(ls_Path, WMF!, FALSE)
END CHOOSE
Beep(3)
IF li_Value=1 THEN
MessageBox('系统信息', '数据保存完毕!')
ELSE
MessageBox('系统信息', '数据保存错误!')
END IF
String ls_File, ls_Path, ls_Ext
Integer li_Value
li_Value = GetFileSaveName ("打印到文件", ls_Path, ls_File, "DOC", &
"文本文件; (*.CSV), *.CVS," + &
"文本文件Tab (*.TXT), *.TXT," + &
"dBASE II (*.DBF), *.DBF," + &
"dBASE III (*.DBF), *.DBF," + &
"DIF文件 (*.DIF), *.DIF," + &
"Excel文件 (*.XLS), *.XLS," + &
"HTML文件 (*.HTM), *.HTM," + &
"PSR文件 (*.PSR), *.PSR," + &
"SQL文件 (*.SQL), *.SQL," + &
"多格式文件 (*.SYL), *.SYL," + &
"Lotus1-2-3 (*.WKS), *.WKS," + &
"Lotus1-2-3 (*.WK1), *.WK1," + &
"WMF Windows (*.WMF), *.WMF")
IF li_Value <> 1 THEN RETURN
IF ls_Path = '' THEN RETURN
IF FileExists(ls_Path) THEN
Beep(3)
IF MessageBox('系统信息', '文件:'+ls_Path+'已存在, 覆盖吗(Yes/No)?', Question!, YesNo!, 2)=2 THEN RETURN
END IF
ls_Ext = Upper(Right(ls_Path, 3))
CHOOSE CASE ls_Ext
// CASE "prn"
// dw_preview.Object.Datawindow.Print.FileName = ls_Path
// dw_preview.Print()
CASE 'CSV'
li_Value = dw_preview.SaveAs(ls_Path, CSV!, FALSE)
CASE 'DBF'
li_Value = dw_preview.SaveAs(ls_Path, dBASE3!, FALSE)
CASE 'DIF'
li_Value = dw_preview.SaveAs(ls_Path, DIF!, FALSE)
CASE 'XLS'
li_Value = dw_preview.SaveAs(ls_Path, Excel!, FALSE)
CASE 'HTM'
li_Value = dw_preview.SaveAs(ls_Path, HTMLTable!, FALSE)
CASE 'PSR'
li_Value = dw_preview.SaveAs(ls_Path, PSReport!, FALSE)
CASE 'SQL'
li_Value = dw_preview.SaveAs(ls_Path, SQLInsert!, FALSE)
CASE 'SYL'
li_Value = dw_preview.SaveAs(ls_Path, SYLK!, FALSE)
CASE 'TXT'
li_Value = dw_preview.SaveAs(ls_Path, Text!, FALSE)
CASE 'WKS'
li_Value = dw_preview.SaveAs(ls_Path, WKS!, FALSE)
CASE 'WK1'
li_Value = dw_preview.SaveAs(ls_Path, WK1!, FALSE)
CASE 'WMF'
li_Value = dw_preview.SaveAs(ls_Path, WMF!, FALSE)
END CHOOSE
Beep(3)
IF li_Value=1 THEN
MessageBox('系统信息', '数据保存完毕!')
ELSE
MessageBox('系统信息', '数据保存错误!')
END IF
展开全部
用追加查询就OK啦!!(假设要把表A中的某条记录复制到表B中)
1、在设计视图中打开表A,并选择要复制的记录
2、单击工具栏中的“查询类型”选择“追加查询”弹出生成表对话框。
表名称选B、选“当前数据库”
基本上就OK了!!
快去试试吧!!
1、在设计视图中打开表A,并选择要复制的记录
2、单击工具栏中的“查询类型”选择“追加查询”弹出生成表对话框。
表名称选B、选“当前数据库”
基本上就OK了!!
快去试试吧!!
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
select
*
into
newtable
from
table
where
字段
like
'%中%'
或如果另一张表已经存在,则用下面的:
insert
into
newtable
select
*
from
table
where
字段
like
'%中%'
如果上面的话,要注意字段是否一样多,或字段类型是否一致的问题.
*
into
newtable
from
table
where
字段
like
'%中%'
或如果另一张表已经存在,则用下面的:
insert
into
newtable
select
*
from
table
where
字段
like
'%中%'
如果上面的话,要注意字段是否一样多,或字段类型是否一致的问题.
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询