📄 frm_hyedit.frm
字号:
Begin VB.Label Label5
Caption = "有效期:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Left = 240
TabIndex = 16
Top = 2124
Width = 1212
End
Begin VB.Label Label6
Caption = "会员类型:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Left = 3960
TabIndex = 15
Top = 240
Width = 1332
End
Begin VB.Label Label8
Caption = "联系电话:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Left = 3960
TabIndex = 14
Top = 1200
Width = 1212
End
Begin VB.Label Label10
Caption = "联系地址:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Left = 240
TabIndex = 13
Top = 2640
Width = 1212
End
Begin VB.Label Label14
Caption = "联系人:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 372
Left = 240
TabIndex = 12
Top = 1200
Width = 1572
End
End
Attribute VB_Name = "frm_hyedit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs As New ADODB.Recordset
Dim strEmpID As String
Dim txt_Active As Integer
Dim str_deptid(50) As String
Private Sub cmdCencal_Click()
cmdClose.Enabled = True
cmdSave.Enabled = False
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub cmdSave_Click()
txt_Active_Get
If txt_Active = 0 Then
str_Msg = MsgBox("输入框信息不能为空,请核对!", vbInformation + vbOKOnly, "中芯德立提示信息")
Exit Sub
End If
'为了保证各字段值不为空,需增加条件
If str_Active = 0 Then
Set rs = GetRecordset(maSys_db, "select * from 会员信息表 where 会员编号='" & txtEmpID.Text & "'")
If Not rs.EOF Then '该员工编号在数据库中已经存在!
str_Msg = MsgBox("该员工编号在数据库中已经存在,请核对!", vbInformation + vbOKOnly, "中芯德立提示信息")
Exit Sub
End If
maSys_db.Execute "insert into 会员信息表(会员编号,会员名称,会员类型,入会时间," _
& "会员有效期,联系人,联系电话,联系地址," _
& "备注,IC卡号)" _
& "values(" _
& "'" & Trim(txtEmpID.Text) & "','" & Trim(txtEmpName.Text) & "','" & Trim(ComboDuty.Text) & "'," _
& "'" & Trim(DTP_Birth.Value) & "','" & Trim(DTP_Date.Value) & "','" & Trim(txtIdCard.Text) & "'," _
& "'" & Trim(txtPhone.Text) & "','" & Trim(txtAddress.Text) & "'," _
& "'启用','0'" & ")"
cmdClose.Enabled = True
cmdSave.Enabled = False
Else
' If ComboDept.ListIndex < 0 Then
maSys_db.Execute "update 会员信息表 set 会员编号='" & Trim(txtEmpID.Text) & "',会员名称='" & Trim(txtEmpName.Text) & "'" _
& ",会员类型='" & Trim(ComboDuty.Text) & "',入会时间='" & Trim(DTP_Birth.Value) & "'" _
& ",会员有效期='" & Trim(DTP_Date.Value) & "',联系人='" & Trim(txtIdCard.Text) & "'" _
& ",联系电话='" & Trim(txtPhone.Text) & "',联系地址='" & Trim(txtAddress.Text) & "'" _
& " where 会员编号='" & Trim(strEmpID) & "'"
' Else
' maSys_db.Execute "update pos_Employee set field_EmployeeID='" & Trim(txtEmpID.Text) & "',field_EmployeeName='" & Trim(txtEmpName.Text) & "'" _
' & ",field_EmployeeSex='" & Trim(str_Sex) & "',field_EmployeeBirth='" & Trim(DTP_Birth.value) & "'" _
' & ",field_EmploymentDate='" & Trim(DTP_Date.value) & "',field_Duty='" & Trim(ComboDuty.Text) & "'" _
' & ",field_Diploma='" & Trim(ComboDiploma.Text) & "',field_Phone='" & Trim(txtPhone.Text) & "'" _
' & ",field_Email='" & Trim(txtEmail.Text) & "',field_Address='" & Trim(txtAddress.Text) & "'" _
' & ",field_Dept='" & Trim(ComboDept.Text) & "',field_deptid='" & Trim(str_deptid(ComboDept.ListIndex)) & "'" & ",field_Filiale='" & Trim(ComboFiliale.Text) & "'" _
' & ",field_Memo='" & Trim(txtMemo.Text) & "',field_IdCard='" & Trim(txtIdCard.Text) & "'" _
' & ",field_IdCard_Address='" & Trim(txtIdCardAddress.Text) & "' where field_EmployeeID='" & Trim(strEmpID) & "'"
' End If
cmdClose.Enabled = True
cmdSave.Enabled = False
End If
End Sub
Private Sub ComboFiliale_Click()
ComboDept_Get '更新combodept的选项
End Sub
Private Sub ComboDept_Get()
' Dim i As Integer
Set rs = GetRecordset(maSys_db, "select * from 会员类型设置表")
If Not rs.EOF Then
ComboDuty.Clear
i = 0
Do While Not rs.EOF
ComboDuty.AddItem Trim(rs!类型名称)
' str_deptid(i) = rs!dept_id
' i = i + 1
rs.MoveNext
Loop
ComboDuty.ListIndex = 0
Else
ComboDuty.Clear
str_Msg = MsgBox("请先设置会员类型信息!", vbInformation + vbOKOnly, "中芯德立提示信息")
End If
End Sub
Private Sub Form_Load()
Me.Top = (Screen.Height - Me.Height) / 2
Me.Left = (Screen.Width - Me.Width) / 2
cmdClose.Enabled = False
DTP_Birth.Value = Format(Now, "yyyy-mm-dd")
DTP_Date.Value = Format(Now, "yyyy") + 1 & "-" & Format(Now, "mm-dd")
frm_Set
End Sub
Private Sub frm_Set()
ComboDept_Get
If str_Active = 0 Then
frm_hyedit.Caption = "会员信息增加"
txt_MsgGet
txtEmpID.Enabled = True
Else
frm_hyedit.Caption = "会员信息修改"
Dim i As Integer
i = frm_hyview.ListViewEmp.SelectedItem
txtEmpID.Text = frm_hyview.ListViewEmp.ListItems(i).SubItems(1) '员工编号
txtEmpName.Text = frm_hyview.ListViewEmp.ListItems(i).SubItems(2) '员工姓名
DTP_Date.Value = frm_hyview.ListViewEmp.ListItems(i).SubItems(5) '有效期
DTP_Birth.Value = frm_hyview.ListViewEmp.ListItems(i).SubItems(4) '入会时间
ComboDuty.Text = frm_hyview.ListViewEmp.ListItems(i).SubItems(3) '职务
txtPhone.Text = frm_hyview.ListViewEmp.ListItems(i).SubItems(7) '电话
txtIdCard.Text = frm_hyview.ListViewEmp.ListItems(i).SubItems(6) '联系人
txtAddress.Text = frm_hyview.ListViewEmp.ListItems(i).SubItems(8) '联系地址
txtEmpID.Enabled = False
strEmpID = txtEmpID.Text
End If
End Sub
Private Sub txt_Active_Get()
txt_Active = 1
txt_Active = txt_Active * IIf(Len(Trim(txtEmpID.Text)) = 0, 0, 1)
txt_Active = txt_Active * IIf(Len(Trim(txtEmpName.Text)) = 0, 0, 1)
txt_Active = txt_Active * IIf(Len(Trim(ComboDuty.Text)) = 0, 0, 1)
' txt_Active = txt_Active * IIf(Len(Trim(ComboDiploma.Text)) = 0, 0, 1)
' txt_Active = txt_Active * IIf(Len(Trim(ComboFiliale.Text)) = 0, 0, 1)
' txt_Active = txt_Active * IIf(Len(Trim(ComboDept.Text)) = 0, 0, 1)
End Sub
Private Sub txt_MsgGet()
txtEmpID.Text = ""
txtEmpName.Text = ""
' ComboDuty.Text = ""
' ComboDiploma.Text = ""
' ComboDept.Text = ""
End Sub
Private Sub Form_Resize()
' Me.Top = 1800
' Me.Left = 4800
End Sub
Private Sub txtEmpID_KeyPress(KeyAscii As Integer)
If KeyAscii > 57 Or KeyAscii < 48 And KeyAscii <> 8 Then
KeyAscii = 0
End If
End Sub
Private Sub txtEmpID_LostFocus()
txtEmpID = Format(txtEmpID, "00000000")
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -