实时错误'3021',BOF或EOF中有一个是"真",或者当前的记录以被删除,所需的操作要求一个当前的记录
svr=GetSvr()user=GetUser()password=GetPassword()RsSource=SqlQurJIZD()MDIForm1.MousePo...
svr = GetSvr()
user = GetUser()
password = GetPassword()
RsSource = SqlQurJIZD()
MDIForm1.MousePointer = vbHourglass
Con.Provider = "SQLOLEDB.1"
Con.ConnectionString = ConStr("hisv3")
Con.ConnectionTimeout = 29
Con.Open
Rs.LockType = adLockOptimistic
Rs.CursorType = adOpenKeyset
Set Rs.ActiveConnection = Con
Rs.Source = RsSource
Rs.Open
If Rs.BOF = True Then
MsgBox "未发现本日有此病人处方"
If Rs.State = adStateOpen Then Rs.Close
If Con.State = adStateOpen Then Con.Close
Set Rs = Nothing
Set Con = Nothing
Exit Sub
End If
result = Rs("user_3") - Rs("user_1") + 1
Rs.MoveFirst
MsgBox Rs.RecordCount
MsgBox Rs("user_3")
Do Until Rs.EOF = True Or Rs("user_3") < result
RsTotle = RsTotle + 1
Rs.MoveNext
Loop
MsgBox Rs.RecordCount
MsgBox Rs("user_3")
这两条语句在运行中测试结果都是有记录的也是我意料中的数值,但一运行到Do Until 语句的时候就出现标题所示的错误提示,真的是没办法了。如图,还请各位指点一二。 展开
user = GetUser()
password = GetPassword()
RsSource = SqlQurJIZD()
MDIForm1.MousePointer = vbHourglass
Con.Provider = "SQLOLEDB.1"
Con.ConnectionString = ConStr("hisv3")
Con.ConnectionTimeout = 29
Con.Open
Rs.LockType = adLockOptimistic
Rs.CursorType = adOpenKeyset
Set Rs.ActiveConnection = Con
Rs.Source = RsSource
Rs.Open
If Rs.BOF = True Then
MsgBox "未发现本日有此病人处方"
If Rs.State = adStateOpen Then Rs.Close
If Con.State = adStateOpen Then Con.Close
Set Rs = Nothing
Set Con = Nothing
Exit Sub
End If
result = Rs("user_3") - Rs("user_1") + 1
Rs.MoveFirst
MsgBox Rs.RecordCount
MsgBox Rs("user_3")
Do Until Rs.EOF = True Or Rs("user_3") < result
RsTotle = RsTotle + 1
Rs.MoveNext
Loop
MsgBox Rs.RecordCount
MsgBox Rs("user_3")
这两条语句在运行中测试结果都是有记录的也是我意料中的数值,但一运行到Do Until 语句的时候就出现标题所示的错误提示,真的是没办法了。如图,还请各位指点一二。 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询