程序报错:Form子句语法错误 实时错误 '-2147217900 (80040e14) '对象 'Refresh '的方法 'IAdodc '失败
时间:2011-11-30
来源:互联网
Dim recc As Integer
Dim sqltxt As String
Private Sub Command1_Click()
flag = 1
frmedbook.Show vbModal
End Sub
Private Sub Command2_Click()
flag = 2
frmedbook.Show vbModal
End Sub
Private 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 Sub
Private 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 Sub
Private 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 Sub
Private 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 If
If Trim(Text1(2).Text) <> "" Then
If expr = "" Then
expr = "书名 = '" & Trim(Text1(2).Text) & "'"
Else
expr = expr & "and 书名 = '" & Trim(Text1(2).Text) & "'"
End If
End If
If Trim(Text1(3).Text) <> "" Then
If expr = "" Then
expr = "作者 = '" & Trim(Text1(3).Text) & "'"
Else
expr = expr & "and 作者 = '" & Trim(Text1(3).Text) & "'"
End If
End If
If Trim(Text1(4).Text) <> "" Then
If expr = "" Then
expr = "出版社 = '" & Trim(Text1(4).Text) & "'"
Else
expr = expr & "and 出版社 = '" & Trim(Text1(4).Text) & "'"
End If
End If
If 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 If
If 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 Sub
Private Sub selcmd2_Click()
Dim i As Integer
For i = 0 To 4
Text1(i).Text = ""
Next i
Combo1.Text = ""
End Sub
Private Sub KeyPress(Index As Integer, KeyAscii As Integer)
Call enddata(KeyAcii)
End Sub
程序报错:Form子句语法错误
实时错误 '-2147217900 (80040e14) '
对象 'Refresh '的方法 'IAdodc '失败
Dim sqltxt As String
Private Sub Command1_Click()
flag = 1
frmedbook.Show vbModal
End Sub
Private Sub Command2_Click()
flag = 2
frmedbook.Show vbModal
End Sub
Private 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 Sub
Private 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 Sub
Private 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 Sub
Private 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 If
If Trim(Text1(2).Text) <> "" Then
If expr = "" Then
expr = "书名 = '" & Trim(Text1(2).Text) & "'"
Else
expr = expr & "and 书名 = '" & Trim(Text1(2).Text) & "'"
End If
End If
If Trim(Text1(3).Text) <> "" Then
If expr = "" Then
expr = "作者 = '" & Trim(Text1(3).Text) & "'"
Else
expr = expr & "and 作者 = '" & Trim(Text1(3).Text) & "'"
End If
End If
If Trim(Text1(4).Text) <> "" Then
If expr = "" Then
expr = "出版社 = '" & Trim(Text1(4).Text) & "'"
Else
expr = expr & "and 出版社 = '" & Trim(Text1(4).Text) & "'"
End If
End If
If 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 If
If 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 Sub
Private Sub selcmd2_Click()
Dim i As Integer
For i = 0 To 4
Text1(i).Text = ""
Next i
Combo1.Text = ""
End Sub
Private Sub KeyPress(Index As Integer, KeyAscii As Integer)
Call enddata(KeyAcii)
End Sub
程序报错:Form子句语法错误
实时错误 '-2147217900 (80040e14) '
对象 'Refresh '的方法 'IAdodc '失败
作者: qq191981978 发布时间: 2011-11-30
"select * from book where" & expr
改成
"select * from book where " & expr
改成
"select * from book where " & expr
作者: chinaboyzyq 发布时间: 2011-11-30
谢谢楼上!已解决
作者: qq191981978 发布时间: 2011-11-30
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28