vb数据库中如果有一个字段重复的,其他字段不重复,怎么逐次点击,逐个显示内容?
附界面及查询代码,求修改!(要实现输入姓名点一次查询,右边的信息对应的输出)PrivateSubCommand1_Click()Timer1.Enabled=FalseA...
附界面及查询代码,求修改! (要实现输入姓名点一次查询,右边的信息对应的输出)
Private Sub Command1_Click()
Timer1.Enabled = False
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Database2.mdb;Persist Security Info=False"Adodc1.RecordSource = "select * from [sheet1] where ID=" & RnAdodc1.Refresh
If Trim(Text1.Text) = "" Then MsgBox "请输入查询内容!" Text1.SetFocus Exit SubEnd IfOn Error Resume NextIf Adodc1.Recordset.EOF And Adodc1.Recordset.BOF Then MsgBox "没有收录该信息", vbOKOnly, "提示" Text1.SetFocus Text1.Text = "" Else Text2.Text = Adodc1.Recordset.Fields("联系方式") Text3.Text = Adodc1.Recordset.Fields("职称") Text4.Text = Adodc1.Recordset.Fields("专业") Text5.Text = Adodc1.Recordset.Fields("单位") Text6.Text = Adodc1.Recordset.Fields("所属地区") '每显示一个记录,就把它从adodc2中删除 Adodc2.RecordSource = "select * from 抽取专家用的表 where ID=" & Rn Adodc2.Recordset.Delete Adodc2.RecordSource = "select * from 抽取专家用的表 order by id" Adodc2.Refresh Label8.Caption = "还有:" & Adodc2.Recordset.RecordCount & "专家"If Adodc2.Recordset.EOF And Adodc2.Recordset.BOF Then MsgBox "专家库中记录已经全部抽取完毕!", , "提示" '调用自定义过程 MySelct() Call MySelctElse Adodc2.Recordset.MoveFirst Adodc2.Recordset.MovePrevious End If End IfEnd Sub 展开
Private Sub Command1_Click()
Timer1.Enabled = False
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Database2.mdb;Persist Security Info=False"Adodc1.RecordSource = "select * from [sheet1] where ID=" & RnAdodc1.Refresh
If Trim(Text1.Text) = "" Then MsgBox "请输入查询内容!" Text1.SetFocus Exit SubEnd IfOn Error Resume NextIf Adodc1.Recordset.EOF And Adodc1.Recordset.BOF Then MsgBox "没有收录该信息", vbOKOnly, "提示" Text1.SetFocus Text1.Text = "" Else Text2.Text = Adodc1.Recordset.Fields("联系方式") Text3.Text = Adodc1.Recordset.Fields("职称") Text4.Text = Adodc1.Recordset.Fields("专业") Text5.Text = Adodc1.Recordset.Fields("单位") Text6.Text = Adodc1.Recordset.Fields("所属地区") '每显示一个记录,就把它从adodc2中删除 Adodc2.RecordSource = "select * from 抽取专家用的表 where ID=" & Rn Adodc2.Recordset.Delete Adodc2.RecordSource = "select * from 抽取专家用的表 order by id" Adodc2.Refresh Label8.Caption = "还有:" & Adodc2.Recordset.RecordCount & "专家"If Adodc2.Recordset.EOF And Adodc2.Recordset.BOF Then MsgBox "专家库中记录已经全部抽取完毕!", , "提示" '调用自定义过程 MySelct() Call MySelctElse Adodc2.Recordset.MoveFirst Adodc2.Recordset.MovePrevious End If End IfEnd Sub 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询