📄 formd1.frm
字号:
VERSION 5.00
Begin VB.Form FormD1
BackColor = &H00C0C0FF&
Caption = " 系 统 定 名"
ClientHeight = 3510
ClientLeft = 60
ClientTop = 345
ClientWidth = 7095
LinkTopic = "Form2"
MaxButton = 0 'False
MinButton = 0 'False
Moveable = 0 'False
ScaleHeight = 3510
ScaleWidth = 7095
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox Text3
Height = 300
Left = 2280
TabIndex = 7
Text = "Text3"
Top = 1920
Width = 4095
End
Begin VB.TextBox Text2
Height = 300
Left = 2280
TabIndex = 4
Text = "Text2"
Top = 1440
Width = 4095
End
Begin VB.CommandButton Command1
Caption = "确 认"
Height = 375
Left = 2280
TabIndex = 2
Top = 2640
Width = 1215
End
Begin VB.TextBox Text1
Height = 300
Left = 2280
TabIndex = 1
Text = "Text1"
Top = 960
Width = 4095
End
Begin VB.CommandButton Command4
BackColor = &H00C0C0FF&
Caption = "退 出"
Height = 375
Left = 3840
TabIndex = 0
Top = 2640
Width = 1215
End
Begin VB.Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "地 点:"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 240
Left = 1320
TabIndex = 8
Top = 1965
Width = 915
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "名 称:"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 240
Left = 1320
TabIndex = 6
Top = 1000
Width = 915
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "冠 名:"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 240
Left = 1320
TabIndex = 5
Top = 1480
Width = 915
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "请输入系统名称 :"
BeginProperty Font
Name = "楷体_GB2312"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 285
Left = 720
TabIndex = 3
Top = 360
Width = 2700
End
End
Attribute VB_Name = "FormD1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim strYm1 As String, strYm2 As String, strYm3 As String
Dim strMc1 As String, strMc2 As String, strMc3 As String
'
Private Sub Form_Load()
Set MyRs2 = New Recordset
StrSQL = "Select * From T_tm Where Dm = 'Mc001'"
MyRs2.Open StrSQL, cnnTce, adOpenKeyset, adLockOptimistic
strYm1 = Trim(MyRs2![Mc]) ' 取出名称
Set MyRs2 = New Recordset
StrSQL = "Select * From T_tm Where Dm = 'Mc002'"
MyRs2.Open StrSQL, cnnTce, adOpenKeyset, adLockOptimistic
strYm2 = Trim(MyRs2![Mc]) ' 取出冠名
Set MyRs2 = New Recordset
StrSQL = "Select * From T_tm Where Dm = 'Mc003'"
MyRs2.Open StrSQL, cnnTce, adOpenKeyset, adLockOptimistic
strYm3 = Trim(MyRs2![Mc]) ' 取出单位
MyRs2.Close
StrCrq = Format(Date, "yyyy.mm.dd")
SetWindowPos Me.hwnd, -1, 0, 0, 0, 0, 3 ' 窗体置前
End Sub
Private Sub Form_Activate()
Text1.Text = " " & strYm1 ' 显示系统原名称
Text2.Text = " " & strYm2
Text3.Text = " " & strYm3
Text1.SetFocus
End Sub
Private Sub Text1_GotFocus() ' 聚焦时反白显示
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub
Private Sub Text2_GotFocus() ' 聚焦时反白显示
Text2.SelStart = 0
Text2.SelLength = Len(Text1.Text)
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command1.SetFocus
End If
End Sub
Private Sub Command1_Click() ' 确认
strMc1 = Trim(Text1.Text)
strMc2 = Trim(Text2.Text)
strMc3 = Trim(Text3.Text)
If strYm1 = strMc1 And strYm2 = strMc2 And strYm3 = strMc3 Then Exit Sub
StrMsg = " 确实要将新的系统"
If strYm1 <> strMc1 And strYm2 <> strMc2 And strYm3 <> strMc3 Then
StrMsg = StrMsg & vbCrLf & vbCrLf
StrMsg = StrMsg & " 名称: " & strMc1 & " " & vbCrLf & vbCrLf
StrMsg = StrMsg & " 冠名: " & strMc2 & " " & vbCrLf & vbCrLf
StrMsg = StrMsg & " 地点: " & strMc3 & " " & vbCrLf & vbCrLf
Else
If strYm1 <> strMc1 Or strYm3 <> strMc3 Then
StrMsg = StrMsg & "名称 " & strMc1
Else
If strYm2 = strMc2 Then
StrMsg = StrMsg & "冠名 " & strMc2
Else
StrMsg = StrMsg & "名称 " & strMc1
End If
End If
End If
StrMsg = StrMsg & " 存盘吗 ? "
If MsgBox(StrMsg, 1 + 32 + 0, " 请 确 认 ") = 1 Then
If strYm1 <> strMc1 Then
Set MyRs0 = New Recordset
StrShm = strMc1
StrSQL = "SELECT * FROM T_tm Where Dm = 'MC001'" ' 系统名称
MyRs0.Open StrSQL, cnnTce, adOpenKeyset, adLockOptimistic
MyRs0![Mc] = StrShm ' 改写
MyRs0.Update
MyRs0.Close
End If
If strYm2 <> strMc2 Then
Set MyRs0 = New Recordset
StrGum = strMc2
StrSQL = "SELECT * FROM T_tm Where Dm = 'MC002'" ' 系统冠名
MyRs0.Open StrSQL, cnnTce, adOpenKeyset, adLockOptimistic
MyRs0![Mc] = strMc2 ' 改写
MyRs0.Update
MyRs0.Close
End If
Form01.Caption = " " & StrGum & StrShm
Form02.Caption = " " & StrGum & StrShm
If strYm3 <> strMc3 Then
Set MyRs0 = New Recordset
strMc3 = strMc3
StrSQL = "SELECT * FROM T_tm Where Dm = 'MC003'" ' 系统地点
MyRs0.Open StrSQL, cnnTce, adOpenKeyset, adLockOptimistic
MyRs0![Mc] = strMc3 ' 改写
MyRs0.Update
MyRs0.Close
Form01.Label5.Caption = " " & strMc3
Form02.Label5.Caption = " " & strMc3
End If
Text1.Text = " " & strMc1
Text2.Text = " " & strMc2
Text3.Text = " " & strMc3
MsgBox " 已将新的系统名称存盘完毕 ... ", 48, " Ok ! "
Command4.SetFocus
End If
End Sub
Private Sub Command4_Click()
Unload Me
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command1.Enabled = True
Command1.SetFocus
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -