📄 searchxg.frm
字号:
Exclusive = -1 'True
Height = 495
Left = 8880
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "select * from 预采数据"
Top = 3120
Visible = 0 'False
Width = 1695
End
Begin MSDBGrid.DBGrid DBGrid1
Bindings = "searchxg.frx":0596
Height = 5775
Left = 0
OleObjectBlob = "searchxg.frx":05AA
TabIndex = 1
Top = 1320
Width = 11415
End
Begin VB.CommandButton Command1
Caption = "退出"
Height = 375
Left = 10440
TabIndex = 0
Top = 120
Width = 975
End
Begin VB.Label Label9
Caption = "选书种册金额:"
Height = 255
Left = 7080
TabIndex = 24
Top = 7200
Width = 3855
End
Begin VB.Label Label8
Caption = "查询结果:"
Height = 255
Left = 0
TabIndex = 23
Top = 7200
Width = 3855
End
Begin VB.Label Label1
Caption = "以下查询结果全选本数:"
Height = 255
Left = 7680
TabIndex = 9
Top = 960
Width = 2055
End
End
Attribute VB_Name = "searchxg"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Unload Me
End Sub
Private Sub Command2_Click()
'查询显示
On Error Resume Next
Dim updstr As String
Dim sqlstr As String
Dim jghigh As Long
Dim jglow As Long
If Option1.Value = True Then
sqlstr = "select * from 预采数据 "
End If
If Option2.Value = True Then
sqlstr = "select * from czisbnno"
End If
If Option3.Value = True Then
sqlstr = "select * from czisbnyes"
End If
field1 = Combo1.Text
If Text2.Text = "" Then
sqllast1 = ""
Else
If field1 = "ISBN号" Then sqllast1 = "isbn like '" & Text2.Text & "*'"
If field1 = "书 名" Then sqllast1 = "bookname like '*" & Text2.Text & "*'"
If field1 = "作 者" Then sqllast1 = "author like '*" & Text2.Text & "*'"
If field1 = "出版社" Then sqllast1 = "bms like '*" & Text2.Text & "*'"
If field1 = "出版年" Then sqllast1 = "bmn like '*" & Text2.Text & "*'"
If field1 = "内 容" Then sqllast1 = "context like '*" & Text2.Text & "*'"
If field1 = "提供商" Then sqllast1 = "provide like '*" & Text2.Text & "*'"
If field1 = "排架号" Then sqllast1 = "bjh like '" & Text2.Text & "*'"
If field1 = "分类号" Then sqllast1 = "class like '" & Text2.Text & "*'"
If field1 = "备注" Then sqllast1 = "other like '" & Text2.Text & "*'"
sqlstr = sqlstr & " where " & sqllast1
End If
field2 = Combo2.Text
If Text3.Text = "" Then
sqllast2 = ""
Else
If field2 = "ISBN号" Then sqllast2 = "isbn like '" & Text3.Text & "*'"
If field2 = "书 名" Then sqllast2 = "bookname like '*" & Text3.Text & "*'"
If field2 = "作 者" Then sqllast2 = "author like '*" & Text3.Text & "*'"
If field2 = "出版社" Then sqllast2 = "bms like '*" & Text3.Text & "*'"
If field2 = "出版年" Then sqllast2 = "bmn like '*" & Text3.Text & "*'"
If field2 = "内 容" Then sqllast2 = "context like '*" & Text3.Text & "*'"
If field2 = "提供商" Then sqllast2 = "provide like '*" & Text3.Text & "*'"
If field2 = "排架号" Then sqllast2 = "bjh like '" & Text3.Text & "*'"
If field2 = "分类号" Then sqllast2 = "class like '" & Text3.Text & "*'"
If field2 = "备注" Then sqllast2 = "other like '" & Text3.Text & "*'"
If field2 = "选书数" Then
If Val(Text3.Text) > 0 Then
sqllast2 = "fbl>0"
Else
sqllast2 = "fbl<=0"
End If
End If
If Text2.Text = "" Then
sqlstr = sqlstr & " where " & sqllast2
Else
sqlstr = sqlstr & " and " & sqllast2
End If
End If
jglow = 0
jghigh = 10000
If Text4.Text = "" Then
jglow = 0
Else
jglow = Val(Text4.Text)
End If
If Text5.Text = "" Then
jghigh = 1000000
Else
jghigh = Val(Text5.Text)
End If
If Text2.Text = "" And Text3.Text = "" Then
sqlstr = sqlstr & " where val(jg) between " & Str(jglow) & " and " & Str(jghigh)
Else
sqlstr = sqlstr & " and (val(jg) between " & Str(jglow) & " and " & Str(jghigh) & ")"
End If
Data2.RecordSource = "select count(*) as zs " & Right(sqlstr, Len(sqlstr) - 8)
Data2.Refresh
ordstr = Combo3.Text
If ordstr = "控制号" Then sqllast3 = "order by ID"
If ordstr = "ISBN号" Then sqllast3 = "order by isbn"
If ordstr = "书 名" Then sqllast3 = "order by bookname"
If ordstr = "作 者" Then sqllast3 = "order by author"
If ordstr = "出版社" Then sqllast3 = "order by bms"
If ordstr = "出版年" Then sqllast3 = "order by bmn"
If ordstr = "价 格" Then sqllast3 = "order by val(jg) desc"
If ordstr = "选书数" Then sqllast3 = "order by fbl desc"
If ordstr = "时 间" Then sqllast3 = "order by modidate desc"
sqlstr = sqlstr & " " & sqllast3
Data1.RecordSource = sqlstr
Data1.Refresh
Label8.Caption = "查询结果:" & Data2.Recordset.Fields("zs").Value & "种"
Data2.RecordSource = "select count(*) as zs,sum(fbl) as cs,sum(fbl*jg) as je from 预采数据 where fbl>0"
Data2.Refresh
Label9.Caption = "当前选书为:" & Data2.Recordset("zs") & "种," & Data2.Recordset("cs") & "册,金额:" & Data2.Recordset("je")
End Sub
Private Sub Command3_Click()
On Error GoTo aa
updstr1 = Data1.RecordSource
If Option1.Value = True Then
updstr = "update 预采数据 set fbl=" & Str(Val(Text1.Text))
End If
If Option2.Value = True Then
updstr = "update czisbnno set fbl=" & Str(Val(Text1.Text))
End If
If Option3.Value = True Then
updstr = "update czisbnyes set fbl=" & Str(Val(Text1.Text))
End If
If InStr(1, updstr1, "where") Then
updstr = updstr & " " & Mid(updstr1, InStr(1, updstr1, "where"), InStr(1, updstr1, "order") - InStr(1, updstr1, "where"))
End If
Set db = Workspaces(0).OpenDatabase("d:\tscg\bookcgk.mdb")
db.Execute updstr, dbFailOnError
db.Close
MsgBox "以下查询出来的数据全选为" & Text1.Text & "本"
Data1.RecordSource = updstr1
Data1.Refresh
Exit Sub
aa:
MsgBox "错误44"
End Sub
Private Sub Form_Load()
Combo2.Text = "书 名"
Combo1.Text = "ISBN号"
Combo3.Text = "控制号"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Data1.RecordSource = "select * from 预采数据 order by id"
Data1.Refresh
Data2.RecordSource = "select count(*) as zs from 预采数据"
Data2.Refresh
Label8.Caption = "查询结果:" & Data2.Recordset("zs").Value & "种"
If banben = "试用" Then
Command3.Enabled = True
End If
If banben = "正式" Then
Command3.Enabled = True
End If
If banben = "PDA" Then
Command3.Enabled = True
End If
If banben = "高级" Then
Command3.Enabled = True
End If
End Sub
Private Sub Option1_Click()
'在GRID中显示所有预采数据
Data1.RecordSource = "select * from 预采数据 order by id"
Data1.Refresh
Data2.RecordSource = "select count(*) as zs from 预采数据"
Data2.Refresh
Label8.Caption = "查询结果:" & Data2.Recordset("zs").Value & "种"
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
End Sub
Private Sub Option2_Click()
Data1.RecordSource = "select * from czisbnno order by id"
Data1.Refresh
Data2.RecordSource = "select count(*) as zs from czisbnno"
Data2.Refresh
Label8.Caption = "查询结果:" & Data2.Recordset("zs").Value & "种"
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
End Sub
Private Sub Option3_Click()
Data1.RecordSource = "select * from czisbnyes order by id"
Data1.Refresh
Data2.RecordSource = "select count(*) as zs from czisbnyes"
Data2.Refresh
Label8.Caption = "查询结果:" & Data2.Recordset("zs").Value & "种"
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -