⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmpeople.frm

📁 我VB遍的工资管理系统
💻 FRM
📖 第 1 页 / 共 3 页
字号:
         Top             =   3120
         Width           =   615
      End
      Begin VB.Label Label19 
         Caption         =   "婚姻状况:"
         Height          =   255
         Left            =   5520
         TabIndex        =   32
         Top             =   2400
         Width           =   975
      End
      Begin VB.Label Label18 
         Caption         =   "文化程度:"
         Height          =   255
         Left            =   3120
         TabIndex        =   30
         Top             =   2400
         Width           =   975
      End
      Begin VB.Label Label17 
         Caption         =   "出生地:"
         Height          =   255
         Left            =   240
         TabIndex        =   28
         Top             =   2400
         Width           =   735
      End
      Begin VB.Label Label16 
         Caption         =   "日"
         Height          =   255
         Left            =   7320
         TabIndex        =   27
         Top             =   1800
         Width           =   255
      End
      Begin VB.Label Label15 
         Caption         =   "月"
         Height          =   255
         Left            =   6240
         TabIndex        =   25
         Top             =   1800
         Width           =   255
      End
      Begin VB.Label Label14 
         Caption         =   "年"
         Height          =   255
         Left            =   5160
         TabIndex        =   23
         Top             =   1800
         Width           =   255
      End
      Begin VB.Label Label13 
         Caption         =   "出生日期:"
         Height          =   255
         Left            =   3120
         TabIndex        =   21
         Top             =   1680
         Width           =   975
      End
      Begin VB.Label Label12 
         Caption         =   "籍贯:"
         Height          =   255
         Left            =   240
         TabIndex        =   19
         Top             =   1680
         Width           =   615
      End
      Begin VB.Label Label11 
         Caption         =   "民族:"
         Height          =   255
         Left            =   6240
         TabIndex        =   17
         Top             =   960
         Width           =   735
      End
      Begin VB.Label Label10 
         Caption         =   "性别:"
         Height          =   255
         Left            =   3360
         TabIndex        =   13
         Top             =   960
         Width           =   735
      End
      Begin VB.Label Label9 
         Caption         =   "身份证号:"
         Height          =   255
         Left            =   240
         TabIndex        =   11
         Top             =   960
         Width           =   975
      End
      Begin VB.Label Label7 
         Caption         =   "与户主关系:"
         Height          =   255
         Left            =   6240
         TabIndex        =   10
         Top             =   360
         Width           =   1095
      End
      Begin VB.Label Label5 
         Caption         =   "姓名:"
         Height          =   255
         Left            =   3360
         TabIndex        =   9
         Top             =   360
         Width           =   615
      End
      Begin VB.Label Label4 
         BorderStyle     =   1  'Fixed Single
         Height          =   255
         Left            =   1920
         TabIndex        =   8
         Top             =   360
         Width           =   735
      End
      Begin VB.Label Label3 
         Caption         =   "-"
         Height          =   255
         Left            =   1680
         TabIndex        =   7
         Top             =   360
         Width           =   135
      End
      Begin VB.Label Label2 
         BorderStyle     =   1  'Fixed Single
         Height          =   255
         Left            =   1200
         TabIndex        =   6
         Top             =   360
         Width           =   375
      End
      Begin VB.Label Label1 
         Caption         =   "所属户号:"
         Height          =   255
         Left            =   240
         TabIndex        =   5
         Top             =   360
         Width           =   975
      End
   End
   Begin VB.CommandButton Command4 
      Caption         =   "创建新户"
      Height          =   375
      Left            =   4800
      TabIndex        =   3
      Top             =   7320
      Width           =   1455
   End
   Begin VB.CommandButton Command3 
      Caption         =   "重置"
      Height          =   375
      Left            =   3600
      TabIndex        =   2
      Top             =   7320
      Width           =   975
   End
   Begin VB.CommandButton Command2 
      Caption         =   "退出"
      Height          =   375
      Left            =   2400
      TabIndex        =   1
      Top             =   7320
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "上一步"
      Height          =   375
      Left            =   1200
      TabIndex        =   0
      Top             =   7320
      Width           =   975
   End
End
Attribute VB_Name = "frmpeople"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub Combo3_click()
'生成可随大小月变化的日期
Dim i As Integer
Dim n As Integer
For i = 0 To 30
Combo4.List(i) = ""
Next i
n = Combo3.ListIndex
Select Case n
Case 0, 2, 4, 6, 7, 9, 11 '当月份为大月时
For i = 0 To 30
Combo4.List(i) = i + 1
Next i
Case 1 '当月份为二月时
For i = 0 To 27
Combo4.List(i) = i + 1
Next i
Combo4.List(28) = "-"
Combo4.List(29) = "-"
Combo4.List(30) = "-"
Case Else '当月份为小月时
For i = 0 To 29
Combo4.List(i) = i + 1
Next i
Combo4.List(30) = "-"
End Select
End Sub

Private Sub Command1_Click() '上一步
frmpeople.Hide
frmhome.Show
End Sub

Private Sub Command10_Click()
Unload frmpeople
flag = 1
frmpeople.Show
End Sub

Private Sub Command2_Click() '退出
Unload frmhome
Unload frmpeople
'初始化主窗口
mainfrm.guanli.Enabled = True
mainfrm.chaxun.Enabled = True
mainfrm.tongji.Enabled = True
If userid = "admin" Then
mainfrm.xitong.Enabled = True
mainfrm.bdb.Enabled = True
Else
mainfrm.xitong.Enabled = False
mainfrm.bdb.Enabled = False
End If
mainfrm.Command1.Enabled = True
mainfrm.Command2.Enabled = True
mainfrm.Command3.Enabled = True
If userid = "admin" Then
mainfrm.Command4.Enabled = True
Else
mainfrm.Command4.Enabled = False
End If
GetStatus "<就绪>"
End Sub

Private Sub Command3_Click() '创建新户页面重置数据
Unload frmpeople
frmpeople.Show
Label2.Caption = tyhuhao1
Label4.Caption = tyhuhao2
Text9.Text = frmhome.Text1.Text
End Sub

Private Sub Command4_Click() '创建新户
'声明变量
Dim huhao As String
Dim hubie As String
Dim huzhu As String
Dim zhuzhi As String
Dim riqi As String
Dim qr_riqi As String
Dim qr_didian As String
Dim tidcard As String
Dim cnn As New ADODB.Connection
Dim ret As New ADODB.Recordset
Dim local_db As String
'检查各项目是否为空
If Text1.Text = "" Then
MsgBox "请输入身份证号", , "警告"
Text1.SetFocus
Else '检查身份证号是否重复
tidcard = Trim(Text1.Text)
Set cnn = New ADODB.Connection
Set ret = New ADODB.Recordset
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path & "\data\db.mdb" + ";Persist Security Info=False;" '连接数据库
local_db = "select 身份证号 from 人口表" + _
" where 人口表.身份证号=" + "'" + tidcard + "'"
ret.Open local_db, cnn
If Not (ret.BOF And ret.EOF) Then
MsgBox "此身份证号已存在,不能重复添加", , "警告"
Text1.Text = ""
Text1.SetFocus
ret.Close
cnn.Close
Else
If Option1.Value = False And Option2.Value = False Then
MsgBox "请选择性别", , "警告"
Else
If Text2.Text = "" Then
MsgBox "请输入民族", , "警告"
Text2.SetFocus
Else
If Text3.Text = "" Then
MsgBox "请输入籍贯", , "警告"
Text3.SetFocus
Else
If Combo2.Text = "" Or Combo3.Text = "" Or Combo4.Text = "" _
Or Combo4.Text = "-" Then
MsgBox "请选择出生日期", , "警告"
Else
If Text4.Text = "" Then
MsgBox "请输入出生地", , "警告"
Text4.SetFocus
Else
If Combo1.Text = "" Then
MsgBox "请选择文化程度", , "警告"
Else
If Option4.Value = False And Option3.Value = False Then
MsgBox "请选择婚姻状况", , "警告"
End If
End If
End If
End If
End If
End If
End If
End If
End If
'将户口登记窗口数据送入数据库
If Text1.Text <> "" And (Option1.Value = True Or Option2.Value = True) _
And Text2.Text <> "" And Text3.Text <> "" And (Combo2.Text <> "" Or Combo3.Text <> "" Or Combo4.Text <> "" _
Or Combo4.Text <> "-") And Text4.Text <> "" And Combo1.Text <> "" And (Option4.Value = True Or Option3.Value = True) Then
'为户口表数据赋值
huhao = frmhome.Text5.Text & frmhome.Label11.Caption & frmhome.Label3.Caption
hubie = frmhome.Combo1.Text
huzhu = frmhome.Text1.Text
zhuzhi = frmhome.Text2.Text
riqi = frmhome.Label7.Caption
qr_riqi = frmhome.Label9.Caption
qr_didian = frmhome.Text3.Text
Set cnn = New ADODB.Connection
Set ret = New ADODB.Recordset
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path & "\data\db.mdb" + ";Persist Security Info=False;" '连接数据库
local_db = "insert into 户口表(户别,户主姓名,户号,住址,登记日期,迁入日期,何地迁入)" + _
" values(" + "'" + hubie + "'," + "'" + huzhu + "'," + "'" + huhao + "'," + "'" + zhuzhi + "'," + "'" + riqi + "'," + _
"'" + qr_riqi + "'," + "'" + qr_didian + "')"
cnn.Execute local_db
cnn.Close
'声明变量
Dim p_xingming As String
Dim p_idcard As String
Dim p_guanxi As String
Dim p_xingbie As String
Dim p_chushengdi As String
Dim p_mingzu As String
Dim p_jiguan As String
Dim p_chushengriqi As String
Dim p_wenhua As String
Dim p_hunyin As String
Dim p_work As String
Dim p_zhiye As String
Dim p_huhao As String
Dim p_qrriqi As String
Dim p_qrdidian As String
'为人口表数据赋值
p_xingming = Trim(Text9.Text)
p_idcard = Trim(Text1.Text)
p_guanxi = Trim(Text10.Text)
If Option1.Value = True Then
p_xingbie = Option1.Caption
End If
If Option2.Value = True Then
p_xingbie = Option2.Caption
End If
p_chushengdi = Trim(Text4.Text)
p_mingzu = Trim(Text2.Text)
p_jiguan = Trim(Text3.Text)
p_chushengriqi = Combo2.Text & Combo3.Text & Combo4.Text
p_wenhua = Combo1.Text
If Option3.Value = True Then
p_hunyin = Option3.Caption
End If
If Option4.Value = True Then
p_hunyin = Option4.Caption
End If
p_work = Trim(Text6.Text)
p_zhiye = Trim(Text5.Text)
p_huhao = Label2.Caption & Label3.Caption & Label4.Caption
If Text7.Text = "" Then
Label23.Enabled = False
p_qrriqi = ""
Else
Label23.Enabled = True
p_qrriqi = Label23.Caption
End If
p_qrdidian = Trim(Text7.Text)
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path & "\data\db.mdb" + ";Persist Security Info=False;" '连接数据库
local_db = "insert into 人口表(姓名,身份证号,与户主关系,性别,出生地,民族,籍贯,出生日期,文化程度,婚姻状况,工作单位,职业,户号,迁入日期,何地迁入)" + _
" values(" + "'" + p_xingming + "'," + "'" + p_idcard + "'," + "'" + p_guanxi + "'," + "'" + p_xingbie + "'," + "'" + p_chushengdi + "'," + "'" + p_mingzu + "'," + _
"'" + p_jiguan + "'," + "'" + p_chushengriqi + "'," + "'" + p_wenhua + "'," + "'" + p_hunyin + "'," + "'" + p_work + "'," + "'" + p_zhiye + "'," + _
"'" + p_huhao + "'," + "'" + p_qrriqi + "'," + "'" + p_qrdidian + "')"
cnn.Execute local_db '将人口表数据送入数据库
MsgBox "您已经成功创建了一个新户籍" + Chr(13) + "您可以继续在此户籍中添加人口" + Chr(13) + "也可以点击退出按钮完成创建", , "提示"
'初始化窗口
Unload frmpeople
frmpeople.Show
frmpeople.Caption = "人口登记表(添加人口)"
Label2.Caption = tyhuhao1
Label4.Caption = tyhuhao2
Text9.Locked = False
Text10.Locked = False
Command4.Enabled = False
Command6.Enabled = True
Command1.Enabled = False
Text9.Text = ""
Text10.Text = ""
Label6.Visible = True
Label8.Visible = True
Command3.Visible = False '重叠放置两个重置按钮,通过变换属性用于不同页面
Command3.Enabled = False
Command7.Visible = True
Command7.Enabled = True
cnn.Close
End If
End Sub

Private Sub Command6_Click() '添加人口
'声明变量
Dim thuhao As String
Dim tidcard As String
Dim tname As String
Dim cnn As New ADODB.Connection
Dim ret As New ADODB.Recordset
Dim local_db As String
thuhao = Label2.Caption & Label3.Caption & Label4.Caption
'检查各项是否为空
If Text9.Text = "" Then
MsgBox "请输入姓名", , "警告"
Text9.SetFocus
Else '检查在同一户籍中是否存在同名人员
tname = Text9.Text
Set cnn = New ADODB.Connection
Set ret = New ADODB.Recordset
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path & "\data\db.mdb" + ";Persist Security Info=False;"
local_db = "select 姓名 from 人口表" + _
" where 人口表.户号=" + "'" + thuhao + "'" + " and 人口表.姓名=" + "'" + tname + "'"
ret.Open local_db, cnn
If Not (ret.BOF And ret.EOF) Then
MsgBox "此户中已有此人,不能重复添加", , "警告"
Text9.Text = ""

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -