[求助] 怎么退出啊?
我在编程时,设定退出条件了,可当输入超出范围时,它不能正确退出程序如下:Private Sub Command6_Click()
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim a As String
Dim b As String
'link and open
Set conn = New ADODB.Connection
conn.ConnectionString = "Provider= Microsoft.Jet.OLEDB.4.0;" & "Data Source=f:\ccjx1.mdb"
conn.CommandTimeout = 20
conn.Open
'set Recordsets and open
Set rs = New ADODB.Recordset
rs.Open "SELECT * from ccmjxsjb where 材料牌号='" & Text1.Text & "' and 厚度='" & Text2.Text & "'", conn, 1, adOpenDynamic
' determine to exit function if rs.EOF Or rs.BOF
If rs.EOF Or rs.BOF Then
MsgBox "没有你需要的数据!"
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
Else
End If
'get data form database and send to control
a = rs.Fields("最小间隙").Value
b = rs.Fields("最大间隙").Value
Text3.Text = a
Text4.Text = b
zmin = Val(a)
zmax = Val(b)
rs.Close
End Sub
错误如下:
运行错误‘3201’
bof或eof有一个为真时,所需的操作要求一个当前记录
请大家帮忙了