谢谢!
这要写是可以...但我的程序是这样的...就不行叻...
Public Sub Command11(Command1 As CommandButton, ByVal index As Integer, datPrimaryRS As Adodc, frmMain As Form)
Select Case index
Case 0 '移到第一条
On Error GoTo err3021
Command1(0).Enabled = False
Command1(3).Enabled = True
Command1(2).Enabled = True
frmMain.datPrimaryRS.Recordset.MoveFirst
err3021:
If Err.Number = 3021 Then
MsgBox "数据库没有数据", vbInformation, "移动出错..."
End If
Case 1 '移到上一条
On Error GoTo err30211
If frmMain.datPrimaryRS.Recordset.AbsolutePosition = adPosBOF Then
Command1(1).Enabled = False
Else
Command1(2).Enabled = True
Command1(0).Enabled = True
Command1(3).Enabled = True
frmMain.datPrimaryRS.Recordset.MovePrevious
End If
err30211:
If Err.Number = 3021 Then
MsgBox "数据库没有数据", vbInformation, "移动出错..."
End If
Case 2 '移到下一条
On Error GoTo err30212
If frmMain.datPrimaryRS.Recordset.AbsolutePosition = adPosEOF Then
Command1(2).Enabled = False
Else
Command1(1).Enabled = True
Command1(0).Enabled = True
Command1(3).Enabled = True
frmMain.datPrimaryRS.Recordset.MoveNext
End If
err30212:
If Err.Number = 3021 Then
MsgBox "数据库没有数据", vbInformation, "移动出错..."
End If
Case 3 '移到最未条
On Error GoTo err30213
Command1(0).Enabled = True
Command1(3).Enabled = False
Command1(1).Enabled = True
frmMain.datPrimaryRS.Recordset.MoveLast
err30213:
If Err.Number = 3021 Then
MsgBox "数据库没有数据", vbInformation, "移动出错..."
End If
End Select
End Sub
[此贴子已经被作者于2007-1-10 15:58:36编辑过]