加一个什么样的条件才能执行到else处??
Dim con As New ADODB.ConnectionDim rs As New ADODB.Recordset
Dim rs2 As New ADODB.Recordset
Dim db As New ADOX.Catalog
Private Sub Command2_Click()
'打开记录集
Set MSHFlexGrid1.DataSource = rs
rs.Close
con.Close
End Sub
Private Sub Command3_Click()
Dim s1 As String
Dim s2 As String
Dim s As String
Dim aa As Boolean
If Text1.Text = "" Then
MsgBox "不能为空", vbCritical, "不能为空"
Exit Sub
Else
s1 = "select * from bookitems"
s2 = s1 & " where ÊéºÅ = '" & Text1.Text & "'"
Set rs2 = con.Execute(s2)
If rs2.RecordCount > 0 Then
'Print rs2.RecordCount
'If (s = "rs2.Fields!书号='" & Text1.Text & "'") Then Set MSHFlexGrid2.DataSource = rs2
MSHFlexGrid2.Refresh
Else MsgBox "没有所查的记录", vbExclamation, "没有记录"
End If
End If