Dim recc As Integer
Dim sqltxt As StringPrivate Sub Command1_Click()
  flag = 1
  frmedbook.Show vbModal
End SubPrivate Sub Command2_Click()
  flag = 2
  frmedbook.Show vbModal
End SubPrivate Sub Command3_Click()
  Dim yn As Integer
  yn = MsgBox("真的要删除《" & Adodc1.Recordset("书名") & "》吗?", vbYesNo, "信息提示")
  If yn = vbYes Then
  Adodc1.Recordset.Delete
  recc = recc - 1
  If recc = 0 Then
  Command2.Enabled = False
  Command3.Enabled = False
  Command4.Enabled = False
  Else
  Command2.Enabled = True
  Command3.Enabled = True
  Command4.Enabled = True
  End If
  End If
End SubPrivate Sub Command4_Click()
  Dim bors As ADODB.Recordset
  Dim bno As String
  If Adodc1.Recordset("借否") Then
  bno = Adodc1.Recordset("图书编号")
  sqltxt = "select borrow.借书证号,reader.姓名,depart.部门名称,borrow.借书日期 from borrow,reader,depart where borrow.图书编号='" & bno & "'and borrow.借书证号=reader.借书证号 and reader.部门代码=depart.id"
  Set bors = exesql(sqltxt)
  MsgBox "借书证号:" & bors("借书证号") & Chr(10) & Chr(13) & "姓 名:" & bors("姓名") & Chr(10) & Chr(13) & "部 门:" & bors("部门") & Chr(13) & Chr(10) & "借书日期:" & bors("借书日期"), , "查找结果"
  Else
  MsgBox "该书没有外借,不能显示借书人", , "信息提示"
  End If
End SubPrivate Sub Form_Activate()
  recc = Adodc1.Recordset.RecordCount
  If recc = 0 Then
  Command2.Enabled = False
  Command3.Enabled = False
  Command4.Enabled = False
  Else
  Command2.Enabled = True
  Command3.Enabled = True
  Command4.Enabled = True
  End If
End SubPrivate Sub selcmd1_Click()
  Dim expr As String
  Dim sta As Boolean
  expr = ""
  If Trim(Text1(0).Text) <> "" Then
  If expr = "" Then
  expr = "图书编号 = '" & Trim(Text1(0).Text) & "'"
  Else
  expr = expr & "and 图书编号 ='" & Trim(Text1(0).Text) & "'"
  End If
  End If  If Trim(Text1(1).Text) <> "" Then
  If expr = "" Then
  expr = "分类号 = '" & Trim(Text1(1).Text) & "'"
  Else
  expr = expr & "and 分类号 = '" & Trim(Text1(1).Text) & "'"
  End If
End IfIf Trim(Text1(2).Text) <> "" Then
  If expr = "" Then
  expr = "书名 = '" & Trim(Text1(2).Text) & "'"
  Else
  expr = expr & "and 书名 = '" & Trim(Text1(2).Text) & "'"
  End If
End IfIf Trim(Text1(3).Text) <> "" Then
  If expr = "" Then
  expr = "作者 = '" & Trim(Text1(3).Text) & "'"
  Else
  expr = expr & "and 作者 = '" & Trim(Text1(3).Text) & "'"
  End If
End IfIf Trim(Text1(4).Text) <> "" Then
  If expr = "" Then
  expr = "出版社 = '" & Trim(Text1(4).Text) & "'"
  Else
  expr = expr & "and 出版社 = '" & Trim(Text1(4).Text) & "'"
  End If
End IfIf Trim(Combo1.Text) <> "" Then
  If Combo1.Text = "借" Then
  sta = True
  Else
  sta = False
  End If
  If expr = "" Then
  expr = "借否=" & sta
  Else
  expr = expr & "借否=" & sta
  End If
End IfIf expr <> "" Then
  Adodc1.RecordSource = "select * from book where" & expr
  Adodc1.CommandType = adCmdText
  Adodc1.Refresh
Else
  Adodc1.RecordSource = "select * from book"
  Adodc1.CommandType = adCmdText
  Adodc1.Refresh
End If
  recc = Adodc1.Recordset.RecordCount
If recc = 0 Then
  MsgBox "没有任何满足条件的记录", , "信息提示"
  Command2.Enabled = False
  Command3.Enabled = False
  Command4.Enabled = False
Else
  Command2.Enabled = True
  Command3.Enabled = True
  Command4.Enabled = True
End If
End SubPrivate Sub selcmd2_Click()
Dim i As Integer
For i = 0 To 4
Text1(i).Text = ""
Next i
Combo1.Text = ""
End SubPrivate Sub KeyPress(Index As Integer, KeyAscii As Integer)
Call enddata(KeyAcii)
End Sub程序报错:Form子句语法错误  
实时错误 '-2147217900 (80040e14) '  
对象 'Refresh '的方法 'IAdodc '失败