📄 frm_czrk_lxfs.frm
字号:
Width = 975
End
Begin VB.CommandButton Cmd_cx
Caption = "查询"
Height = 375
Left = 5640
TabIndex = 4
Top = 240
Width = 975
End
Begin VB.CommandButton Cmd_edit
Caption = "修改"
Height = 375
Left = 2400
TabIndex = 3
Top = 240
Width = 975
End
Begin VB.CommandButton Cmd_del
Caption = "删除"
Height = 375
Left = 1320
TabIndex = 2
Top = 240
Width = 975
End
Begin VB.CommandButton Cmd_add
Caption = "增加"
Height = 375
Left = 240
TabIndex = 1
Top = 240
Width = 975
End
End
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 120
Top = 5640
Width = 7815
_ExtentX = 13785
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=RKGL"
OLEDBString = "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=RKGL"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select * from Table_HKB_TXFS"
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 VB.TextBox Text10
DataField = "人口编号"
DataSource = "Adodc1"
Height = 375
Left = 600
TabIndex = 29
Text = "Text10"
Top = 4080
Width = 1575
End
Begin MSAdodcLib.Adodc Adodc2
Height = 375
Left = 1200
Top = 3720
Width = 2175
_ExtentX = 3836
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=RKGL"
OLEDBString = "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=RKGL"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select * from Table_HKB"
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
End
Attribute VB_Name = "frm_CZRK_LXFS"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Cmd_add_Click() '信息增加
Frame2.Caption = "居民联系信息增加"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text7.Locked = False
Text8.Locked = False
Text9.Locked = False
Text1.SetFocus
Cmd_del.Enabled = False
Cmd_edit.Enabled = False
Cmd_save.Enabled = True
End Sub
Private Sub Cmd_cx_Click() '信息查询
If Text1.Text = "" Then
MsgBox "请您输入人口编号进行查询社区人口的通讯信息", 32, "人口信息管理系统"
Text1.SetFocus
Else
Adodc1.RecordSource = "select * from Table_HKB_TXFS where 人口编号='" + Text1.Text + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Text1.Text = Adodc1.Recordset.Fields("人口编号")
Text2.Text = Adodc1.Recordset.Fields("姓名")
Text3.Text = Adodc1.Recordset.Fields("楼号")
Text4.Text = Adodc1.Recordset.Fields("户号")
Text5.Text = Adodc1.Recordset.Fields("住址")
Text6.Text = Adodc1.Recordset.Fields("电话")
Text7.Text = Adodc1.Recordset.Fields("传真")
Text8.Text = Adodc1.Recordset.Fields("呼机")
Text9.Text = Adodc1.Recordset.Fields("E_mail")
Else
MsgBox "没有此人的通讯信息", 32, "社区人口信息管理系统"
Text1.Text = ""
Text1.SetFocus
End If
End If
End Sub
Private Sub Cmd_del_Click() '信息删除
Frame2.Caption = "居民联系信息删除"
Dim i
Adodc1.RecordSource = "select * from Table_HKB_TXFS"
If Adodc1.Recordset.RecordCount > 0 Then
i = MsgBox("您确认要删除该信息么?", 17, "人口信息管理系统")
If i = vbOK Then
Adodc1.Recordset.Delete
Else
End If
Else
MsgBox "数据库中已经没有可以删除的记录", 48, "人口信息管理系统"
End If
End Sub
Private Sub Cmd_edit_Click() '信息修改
Frame2.Caption = "居民联系信息修改"
If Text1.Text = "" Then
MsgBox "输入数据不能为空", 32, "提示'"
Text1.SetFocus
Else
Adodc1.RecordSource = "select * from Table_HKB_TXFS where 人口编号='" + Text1.Text + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Text1.Text = Adodc1.Recordset.Fields("人口编号")
Text2.Text = Adodc1.Recordset.Fields("姓名")
Text3.Text = Adodc1.Recordset.Fields("楼号")
Text4.Text = Adodc1.Recordset.Fields("户号")
Text5.Text = Adodc1.Recordset.Fields("住址")
Text6.Text = Adodc1.Recordset.Fields("电话")
Text7.Text = Adodc1.Recordset.Fields("传真")
Text8.Text = Adodc1.Recordset.Fields("呼机")
Text9.Text = Adodc1.Recordset.Fields("E_mail")
Text7.Locked = False
Text8.Locked = False
Text9.Locked = False
Text7.SetFocus
Else
End If
End If
Cmd_save.Enabled = True
Cmd_add.Enabled = False
Cmd_del.Enabled = False
End Sub
Private Sub Cmd_exit_Click() '关闭窗体
Unload Me
End Sub
Private Sub Cmd_print_Click() '信息打印
DataEnvironment1.rsCommand1.Open "select * from Table_HKB_TXFS"
If DataEnvironment1.rsCommand1.RecordCount > 0 Then
Data_CZRK_TXFS.Show
Else
MsgBox "没有可以打印的信息!"
DataEnvironment1.rsCommand1.Close
End If
End Sub
Private Sub Cmd_save_Click() '信息保存
Call main
If Frame2.Caption = "居民联系信息增加" Then
If Text1.Text = "" Then
MsgBox "输入数据不能为空", 32, "提示"
Text1.SetFocus
Else
Adodc1.RecordSource = "select * from Table_HKB_TXFS where 人口编号='" + Text1.Text + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
MsgBox "此人的通讯方式已经存在!", 48, "提示"
Else
Set adoRs = adoCon.Execute("insert into Table_HKB_TXFS values(" & Text1 & ",'" & Text2 & "','" & Text3 & "','" & Text4 & "','" & Text5 & "','" & Text6 & "','" & Text7 & "','" & Text8 & "','" & Text9 & "')")
MsgBox "数据保存成功", 32, "提示"
Adodc1.RecordSource = "select * from Table_HKB_TXFS order by 人口编号"
Adodc1.Refresh
End If
Cmd_save.Enabled = False
Cmd_add.Enabled = True
Cmd_del.Enabled = True
Cmd_edit.Enabled = True
End If
Adodc1.Refresh
ElseIf Frame2.Caption = "居民联系信息修改" Then
Adodc1.RecordSource = "select * from Table_HKB_TXFS"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.Delete
Set adoRs = adoCon.Execute("insert into Table_HKB_TXFS values(" & Text1 & ",'" & Text2 & "','" & Text3 & "','" & Text4 & "','" & Text5 & "','" & Text6 & "','" & Text7 & "','" & Text8 & "','" & Text9 & "')")
MsgBox "数据修改成功", 32, "提示"
Else
MsgBox "没有可以修改的信息", 32, "提示"
End If
Adodc1.RecordSource = "select * from Table_HKB_TXFS order by 人口编号"
Adodc1.Refresh
End If
adoCon.Close
End Sub
Private Sub Cmd_sx_Click()
Cmd_add.Enabled = True
Cmd_del.Enabled = True
Cmd_edit.Enabled = True
Cmd_save.Enabled = False
Adodc1.RecordSource = "select * from Table_HKB_TXFS order by 人口编号"
Adodc1.Refresh
End Sub
Private Sub Form_Load()
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
If Text1.Text = "" Then
frm_CZRK_TEMP1.Show
Else
Dim StrInput, Temp As String
Dim i, Length As Integer
i = 1
StrInput = Text1.Text
Length = Len(StrInput)
Do While (i <= Length)
Temp = Mid$(StrInput, i, 1)
If Asc(Temp) < 48 Or Asc(Temp) > 57 Then
If i = 1 Then
MsgBox "输入数据非法!!", , "提示"
Else
End If
Text1.Text = ""
Text1.SetFocus
Else
End If
i = i + 1
Loop
If Text1.Text = "" Then
Text1.SetFocus
Else
Adodc2.RecordSource = "select * from Table_HKB where 人口编号='" + Text1.Text + "'"
Adodc2.Refresh
If Adodc2.Recordset.RecordCount > 0 Then
Adodc1.RecordSource = "select * from Table_HKB_TXFS where 人口编号='" + Text1.Text + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
MsgBox "此人的通讯方式已经存在!", 48, "提示"
Adodc1.RecordSource = "select * from Table_HKB_TXFS order by 人口编号"
Adodc1.Refresh
Text1.Text = ""
Text1.SetFocus
Else
Text7.SetFocus
Adodc1.RecordSource = "select * from Table_HKB_TXFS order by 人口编号"
Adodc1.Refresh
End If
Text2.Text = Adodc2.Recordset.Fields("姓名")
Text3.Text = Adodc2.Recordset.Fields("楼号")
Text4.Text = Adodc2.Recordset.Fields("户号")
Text5.Text = Adodc2.Recordset.Fields("住址")
Text6.Text = Adodc2.Recordset.Fields("联系电话2")
Else
MsgBox "没有此人口编号!", 48, "提示"
End If
End If
End If
Else
End If
End Sub
Private Sub Text7_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Dim StrInput, Temp As String
Dim i, Length As Integer
i = 1
StrInput = Text1.Text
Length = Len(StrInput)
If Text1.Text = "" Then
MsgBox "输入不能为空", , "提示"
Text1.SetFocus
Else
Do While (i <= Length)
Temp = Mid$(StrInput, i, 1)
If Asc(Temp) < 48 Or Asc(Temp) > 57 Then
If i = 1 Then
MsgBox "输入数据非法!!", , "提示"
Else
End If
Text1.Text = ""
Text1.SetFocus
Else
End If
i = i + 1
Loop
If Text1.Text = "" Then
Text1.SetFocus
Else
Text8.SetFocus
End If
End If
Else
End If
End Sub
Private Sub Text8_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text9.SetFocus
Else
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -