📄 frmtzs.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Begin VB.Form 条件数
BorderStyle = 4 'Fixed ToolWindow
Caption = "条件置数"
ClientHeight = 4470
ClientLeft = 45
ClientTop = 270
ClientWidth = 6015
LinkTopic = "Form2"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4470
ScaleWidth = 6015
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command4
Caption = "确定"
Height = 375
Left = 960
TabIndex = 9
Top = 3990
Width = 1095
End
Begin VB.Frame Frame2
Caption = "置数:"
Height = 975
Left = 0
TabIndex = 17
Top = 2880
Width = 6015
Begin VB.TextBox Text2
Height = 330
Left = 2670
TabIndex = 8
Top = 480
Width = 2775
End
Begin MSDataListLib.DataCombo DataCombo3
Bindings = "Frmtzs.frx":0000
Height = 330
Left = 570
TabIndex = 7
Top = 480
Width = 1575
_ExtentX = 2778
_ExtentY = 582
_Version = 393216
ListField = "字段名称"
Text = " "
End
Begin VB.Label Label7
Caption = "="
BeginProperty Font
Name = "宋体"
Size = 18
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 2370
TabIndex = 20
Top = 480
Width = 375
End
Begin VB.Label Label6
Caption = "字段名称:"
Height = 255
Left = 570
TabIndex = 19
Top = 240
Width = 975
End
Begin VB.Label Label5
Caption = "值:"
Height = 255
Left = 2730
TabIndex = 18
Top = 240
Width = 735
End
End
Begin VB.CommandButton Command6
Caption = "取消"
Height = 375
Left = 3960
TabIndex = 10
Top = 3990
Width = 1095
End
Begin VB.Frame Frame1
Caption = "条件:"
Height = 2895
Left = 0
TabIndex = 11
Top = 0
Width = 6015
Begin VB.CommandButton Command5
Caption = "清除"
Height = 375
Left = 2880
TabIndex = 5
Top = 1125
Width = 1215
End
Begin VB.ComboBox Combo1
Height = 300
ItemData = "Frmtzs.frx":0015
Left = 2280
List = "Frmtzs.frx":002E
TabIndex = 1
Text = "="
Top = 600
Width = 975
End
Begin VB.CommandButton Command1
Caption = "加入AND条件"
Height = 375
Left = 120
TabIndex = 3
Top = 1125
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "加入OR条件"
Height = 375
Left = 1440
TabIndex = 4
Top = 1125
Width = 1215
End
Begin VB.CommandButton Command3
Caption = "列出可能的值"
Height = 375
Left = 4320
TabIndex = 6
Top = 1125
Width = 1455
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 120
MultiLine = -1 'True
ScrollBars = 1 'Horizontal
TabIndex = 12
Top = 2040
Width = 5535
End
Begin MSAdodcLib.Adodc Adodc2
Height = 330
Left = 3120
Top = 1560
Visible = 0 'False
Width = 1200
_ExtentX = 2117
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 2
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "FILE NAME=C:\Program Files\Common Files\Linkmain .UDL"
OLEDBString = ""
OLEDBFile = "C:\Program Files\Common Files\Linkmain .UDL"
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "main"
Caption = "Adodc2"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 1560
Top = 1560
Visible = 0 'False
Width = 1200
_ExtentX = 2117
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 2
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "FILE NAME=C:\Program Files\Common Files\Linkmain .UDL"
OLEDBString = ""
OLEDBFile = "C:\Program Files\Common Files\Linkmain .UDL"
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "mainformat1"
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSDataListLib.DataCombo DataCombo2
Bindings = "Frmtzs.frx":004F
Height = 330
Left = 3720
TabIndex = 2
Top = 600
Width = 1815
_ExtentX = 3201
_ExtentY = 582
_Version = 393216
ListField = ""
Text = ""
End
Begin MSDataListLib.DataCombo DataCombo1
Bindings = "Frmtzs.frx":0064
Height = 330
Left = 120
TabIndex = 0
Top = 600
Width = 1695
_ExtentX = 2990
_ExtentY = 582
_Version = 393216
ListField = "字段名称"
Text = " "
End
Begin VB.Label Label4
Caption = "全部条件:"
Height = 255
Left = 120
TabIndex = 16
Top = 1680
Width = 855
End
Begin VB.Label Label3
Caption = "值:"
Height = 255
Left = 3720
TabIndex = 15
Top = 240
Width = 735
End
Begin VB.Label Label2
Caption = "运算符:"
Height = 255
Left = 2280
TabIndex = 14
Top = 240
Width = 735
End
Begin VB.Label Label1
Caption = "字段名称:"
Height = 255
Left = 120
TabIndex = 13
Top = 240
Width = 1335
End
End
End
Attribute VB_Name = "条件数"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim r As Integer
Dim a As String
Dim b(2) As String
Dim c As String
Dim n As Integer
Private Sub Command1_Click()
Dim type1 As String
b(0) = DataCombo1.Text
b(1) = Combo1.Text
b(2) = DataCombo2.Text
Adodc1.Refresh
Do Until Adodc1.Recordset.EOF
If Adodc1.Recordset.Fields("字段名称") = DataCombo1.Text Then
type1 = Adodc1.Recordset.Fields("类型")
Exit Do
End If
Adodc1.Recordset.MoveNext
Loop
If n = 0 Then
If type1 = "C" Then
a = b(0) & b(1) & "'" & b(2) & "'"
Else
a = b(0) & b(1) & b(2)
End If
c = c & a
Text1.Text = c
n = n + 1
Else
If type1 = "C" Then
a = " and " & b(0) & b(1) & "'" & b(2) & "'"
Else
a = " and " & b(0) & b(1) & b(2)
End If
c = c & a
Text1.Text = c
End If
End Sub
Private Sub Command2_Click()
Dim type1 As String
b(0) = DataCombo1.Text
b(1) = Combo1.Text
b(2) = DataCombo2.Text
Adodc1.Refresh
Do Until Adodc1.Recordset.EOF
If Adodc1.Recordset.Fields("字段名称") = DataCombo1.Text Then
type1 = Adodc1.Recordset.Fields("类型")
Exit Do
End If
Adodc1.Recordset.MoveNext
Loop
If n = 0 Then
If type1 = "C" Then
a = b(0) & b(1) & "'" & b(2) & "'"
Else
a = b(0) & b(1) & b(2)
End If
c = c & a
Text1.Text = c
n = n + 1
Else
If type1 = "C" Then
a = " or " & b(0) & b(1) & "'" & b(2) & "'"
Else
a = " or " & b(0) & b(1) & b(2)
End If
c = c & a
Text1.Text = c
End If
End Sub
Private Sub Command3_Click()
DataCombo2.ListField = DataCombo1.Text
End Sub
Private Sub Command4_Click()
On Error GoTo err
Dim type1 As String
b(0) = DataCombo1.Text
b(1) = Combo1.Text
b(2) = DataCombo2.Text
Adodc1.Refresh
Do Until Adodc1.Recordset.EOF
If Adodc1.Recordset.Fields("字段名称") = DataCombo1.Text Then
type1 = Adodc1.Recordset.Fields("类型")
Exit Do
End If
Adodc1.Recordset.MoveNext
Loop
If n = 0 Then
If type1 = "C" Then
a = b(0) & b(1) & "'" & b(2) & "'"
Else
a = b(0) & b(1) & b(2)
End If
c = c & a
Text1.Text = c
End If
Dim SQL As String
Dim mydb As Database
Dim name As String
Dim value As String
name = DataCombo3.Text
value = Text2.Text
Set mydb = OpenDatabase("c:\program files\common files\main.mdb")
SQL = "update main set" & " " & name & "=" & value & " " & "where" & " " & Text1.Text
mydb.Execute SQL
mydb.Close
Frmmain.Adodc1.Refresh
n = 0
c = ""
Text1.Text = ""
Unload Me
For i = 0 To Frmmain.Adodc1.Recordset.Fields.Count - 1
Frmmain.DataGrid1.Columns(i).Width = 10950 / Frmmain.Adodc1.Recordset.Fields.Count
Next i
Exit Sub
err:
Text1.Text = ""
c = ""
n = 0
MsgBox "条件或置数错误,请重新输入!", vbQuestion + vbOKOnly, "条件错误"
End Sub
Private Sub Command5_Click()
Text1.Text = ""
c = Text1.Text
n = 0
End Sub
Private Sub Command6_Click()
Unload 条件数
n = 0
c = ""
Text1.Text = ""
End Sub
Private Sub Form_Load()
r = 0
Adodc2.Refresh
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -