📄 form5.frm
字号:
Left = 1560
TabIndex = 17
Top = 3960
Width = 1095
End
Begin VB.Label Label4
Caption = "名称"
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1560
TabIndex = 16
Top = 3480
Width = 855
End
Begin VB.Label Label3
Caption = "个"
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 4560
TabIndex = 14
Top = 720
Width = 495
End
Begin VB.Label Label2
Caption = "共"
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1680
TabIndex = 13
Top = 720
Width = 495
End
Begin VB.Label Label1
Caption = "请输入您所在地区共有多少个数据采集点:"
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 600
TabIndex = 0
Top = 120
Width = 6135
End
End
Attribute VB_Name = "Form5"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private bc As Integer
Private Sub Command1_Click()
If Adodc1.Recordset.BOF Then
MsgBox ("库中没有记录!!")
Exit Sub
End If
Adodc1.Recordset.MovePrevious
If Adodc1.Recordset.BOF = True Then
MsgBox ("首记录!!")
Adodc1.Recordset.MoveFirst
If Adodc1.Recordset.BOF = True Then
MsgBox ("库中没有记录!!")
Exit Sub
End If
End If
Text2.Text = Adodc1.Recordset!mc
Text3.Text = Adodc1.Recordset!dm
Text4.Text = Adodc1.Recordset!hm
End Sub
Private Sub Command2_Click()
If Adodc1.Recordset.EOF Then
MsgBox ("库中没有记录!!")
Exit Sub
End If
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.EOF = True And Adodc1.Recordset.BOF = True Then
MsgBox ("库中没有记录!!")
Text2.Text = ""
Text3.Text = ""
Exit Sub
ElseIf Adodc1.Recordset.EOF = True Then
MsgBox ("末记录!!")
Adodc1.Recordset.MovePrevious
End If
Text2.Text = Adodc1.Recordset!mc
Text3.Text = Adodc1.Recordset!dm
Text4.Text = Adodc1.Recordset!hm
End Sub
Private Sub Command3_Click()
If Not fso.FolderExists("c:\gxk") Then
fso.CreateFolder ("c:\gxk")
End If
If Not fso.FolderExists("c:\dak") Then
fso.CreateFolder ("c:\dak")
End If
If Not fso.FolderExists("c:\dkk") Then
fso.CreateFolder ("c:\dkk")
End If
bc = 1
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Command5.Enabled = True
Command6.Enabled = True
Command7.Enabled = False
Command8.Enabled = False
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
End Sub
Private Sub Command4_Click()
bc = 2
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Command5.Enabled = True
Command6.Enabled = True
Command7.Enabled = False
Command8.Enabled = False
End Sub
Private Sub Command5_Click()
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
Command5.Enabled = False
Command6.Enabled = False
Command7.Enabled = True
Command8.Enabled = True
End Sub
Private Sub Command6_Click()
If Text2.Text = "" Or Text3.Text = "" Or Text4.Text = "" Then
MsgBox ("项目没有录全,不能保存!!")
Exit Sub
End If
If bc = 1 Then
Adodc1.Recordset.AddNew
Adodc1.Recordset!mc = Trim(Text2.Text)
Adodc1.Recordset!dm = Trim(Text3.Text)
Adodc1.Recordset!hm = Trim(Text4.Text)
Adodc1.Recordset.Update
Else
Adodc1.Recordset!mc = Trim(Text2.Text)
Adodc1.Recordset!dm = Trim(Text3.Text)
Adodc1.Recordset!hm = Trim(Text4.Text)
Adodc1.Recordset.Update
End If
Dim s As String
s = Text3.Text
If Not fso.FolderExists("c:\gxk\" & s) Then
fso.CreateFolder ("c:\gxk\" & s)
End If
If Not fso.FolderExists("c:\dak\" & s) Then
fso.CreateFolder ("c:\dak\" & s)
End If
If Not fso.FolderExists("c:\dkk\" & s) Then
fso.CreateFolder ("c:\dkk\" & s)
End If
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
Command5.Enabled = False
Command6.Enabled = False
Command7.Enabled = True
Command8.Enabled = True
End Sub
Private Sub Command7_Click()
If Adodc1.Recordset.BOF = True Or Adodc1.Recordset.EOF = True Then
MsgBox ("当前记录为空,不能删除!!")
Exit Sub
End If
Adodc1.Recordset.Delete
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
fso.DeleteFile "c:\gxk\" & Trim(Text3.Text), True
fso.DeleteFile "c:\dak\" & Trim(Text3.Text), True
fso.DeleteFile "c:\dkk\" & Trim(Text3.Text), True
End Sub
Private Sub Command8_Click()
Adodc1.Recordset.Requery
Dim x As Integer
Dim y As Integer
If Text1.Text = "" Then
Unload Me
Exit Sub
End If
x = Adodc1.Recordset.RecordCount
y = Text1.Text
If x <> y Then
MsgBox ("您输入的采集点个数和所产生的地区个数不符合,不能退出!!")
Exit Sub
End If
Unload Me
End Sub
Private Sub Form_Load()
Command5.Enabled = False
Command6.Enabled = False
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
If KeyAscii < 48 Or KeyAscii > 57 Then
MsgBox ("应该输入数字,并且为两位。。")
Text4.Text = ""
Exit Sub
End If
End Sub
Private Sub Text4_LostFocus()
If Len(Text4.Text) <> 2 Then
MsgBox ("编号应为两位。。")
Text4.Text = ""
Text4.SetFocus
Exit Sub
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -