1,216
社区成员
发帖
与我相关
我的任务
分享
Public Sub Dataview()
If Adodc1.Recordset.Fields(0) <> "" Then Text1.Text = Adodc1.Recordset.Fields(0)
If Adodc1.Recordset.Fields(1) <> "" Then Text2.Text = Adodc1.Recordset.Fields(1)
If Adodc1.Recordset.Fields(2) <> "" Then Text3.Text = Adodc1.Recordset.Fields(2)
If Adodc1.Recordset.Fields(3) <> "" Then Combo1.Text = Adodc1.Recordset.Fields(3)
If Adodc1.Recordset.Fields(4) <> "" Then Text5.Text = Adodc1.Recordset.Fields(4)
If Adodc1.Recordset.Fields(5) <> "" Then Text6.Text = Adodc1.Recordset.Fields(5)
If Adodc1.Recordset.Fields(6) <> "" Then Text7.Text = Adodc1.Recordset.Fields(6)
Label8.Caption = Trim(str(Adodc1.Recordset.AbsolutePosition)) & "/" & Trim(str(Adodc1.Recordset.RecordCount))
End Sub
*****************************************************原先查询按钮的代码
Dim ree As Integer '定义指定记录值的变量
Dim str As String
str = InputBox("请输入所需要查找的记录:", "查找记录")
ree = Val(str)
If ree < 1 Or ree > Adodc1.Recordset.RecordCount Then
MsgBox "查找的记录超出了范围", vbOKOnly + vbExclamation, "注意"
Exit Sub
Else
If ree > Adodc1.Recordset.AbsolutePosition Then
Do While ree > Adodc1.Recordset.AbsolutePosition
Adodc1.Recordset.Movenext
Loop
Else
Do While ree < Adodc1.Recordset.AbsolutePosition
Adodc1.Recordset.Moveprevious
Loop
End If
Call Dataview