杨杨 发表于:2011-03-09 13:15:55
Private Sub cmd1_Click()
Dim record1 As ADODB.Recordset, record2 As ADODB.Recordset
condition = ""
DoCmd.Close acForm, "高级查询结果"
DoCmd.DeleteObject acTable, "高级查询"
string1 = "create table 高级查询(会员编号 long, 姓名 varchar(10),部门 varchar(10),性别 varchar(5),政治面貌 varchar(10))"
DoCmd.RunSQL string1 --------------这里出错 不知道为什么!!!
openrecord "select * form 高级查询", record1
If Check1.Value = True Then condition = "部门='" & cbo_dept.Value & "'"
If Check2.Value = True Then
If condition = "" Then
condition = "职称='" & cbo_pos.Value & "'"
Else
condition = condition + "and 职称='" & cbo_pos.Value & "'"
End If
End If
If condition = "" Then
openrecord "select * form 会员信息查询 where " & condition, record2
End If
Do Until record2.EOF
record1.AddNew
record1("会员编号") = record2("会员编号")
record1("姓名") = record2("姓名")
record1("部门") = record2("部门")
record1("职称") = record2("职称")
record1("政治面貌") = record2("政治面貌")
record1.Update
record2.MoveNext
Loop
DoCmd.OpenForm "高级查询结果"
End Sub
string1 = "create table 高级查询 (会员编号 long, 姓名 char(10),部门 char(10),性别 char(5),政治面貌 char(10))"
CurrentDb.Execute string1
可参见《表的创建、修改、删除》一文。
谢谢 问题解决了
总记录:2篇 页次:1/1 9 1 :