开发工具:
文件大小: 1mb
下载次数: 0
上传时间: 2010-01-11
详细说明: Option Explicit Dim Bupdata As Boolean Dim i As Integer Private Sub Cmbdegree_Click() If Cmbdegree.Text = "定制" Then FrmTable.Show Cmbdegree.ListIndex = 0 End If End Sub Private Sub Cmbdepart_Click() If Cmbdepart.Text = "定制" Then FrmTable.Show Cmbdepart.ListIndex = 0 End If End Sub Private Sub CmdAddNew_Click() If CmdAddNew.Caption = "添加" Then CmdAddNew.Caption = "确认" CmdDel.Enabled = False CmdOK.Enabled = False DataA.ReadOnly = False For i = 1 To 12 If Txt(i).Text = "" Then Txt(i).Text = 0 'DataA.Recordset.Fields(i) = 0 Next i DataA.Recordset.AddNew Txt(0).Locked = False If FrmMain.cutable = "employee" Then DataA.Recordset.Fields(13) = frmLogin.EmploID DataA.Recordset.Fields(14) = Now If Opsex(0) Then DataA.Recordset.Fields(4) = "男" Else DataA.Recordset.Fields(4) = "女" End If DataA.Recordset.Fields(7) = Cmbdegree.Text DataA.Recordset.Fields(8) = Cmbdepart.Text ElseIf FrmMain.cutable = "leave" Then DataA.Recordset.Fields(8) = frmLogin.EmploID DataA.Recordset.Fields(9) = Now Else DataA.Recordset.Fields(13) = frmLogin.EmploID DataA.Recordset.Fields(14) = Now End If Txt(0).SetFocus Else 'OK If Txt(0).Text = "" Then MsgBox "不可以为空" Txt(0).SetFocus Exit Sub End If For i = 1 To 12 If Txt(i).Text = "" Then Txt(i).Text = 0 'DataA.Recordset.Fields(i) = 0 Next i If FrmMain.cutable = "employee" Then DataB.Recordset.FindFirst "职工编号=" + Txt(0).Text If Not DataB.Recordset.NoMatch Then MsgBox "职员编号重复" Txt(0).Text = "" Txt(0).SetFocus Exit Sub End If ElseIf FrmMain.cutable = "leave" Then DataB.Recordset.FindFirst "假条编号=" + Txt(0).Text If Not DataB.Recordset.NoMatch Then MsgBox "假条编号重复" Txt(0).Text = "" Txt(0).SetFocus Exit Sub End If Else For i = 4 To 10 If Not IsNumeric(Txt(i).Text) Then MsgBox "not a number" Txt(i).SetFocus Exit Sub End If Next i DataB.Recordset.FindFirst "工资编号=" + Txt(0).Text If Not DataB.Recordset.NoMatch Then MsgBox "工资编号重复" Txt(0).Text = "" Txt(0).SetFocus Exit Sub End If End If DataA.Recordset.Update DataA.Recordset.MoveLast FrmMain.DataA.Refresh FrmMain.DataB.Refresh DataB.Refresh CmdAddNew.Caption = "添加" CmdDel.Enabled = True CmdOK.Enabled = True End If End Sub Private Sub CmdCacel_Click() If CmdAddNew.Caption = "确认" Then DataA.Recordset.CancelUpdate End If FrmMain.Enabled = True FrmMain.SetFocus Unload Me FrmMain.DataA.Refresh If FrmMain.cutable = "employee" Then FrmMain.DBGA.Columns("性别").Button = True FrmMain.DBGA.Columns("学历").Button = True FrmMain.DBGA.Columns("部门").Button = True End If End Sub Private Sub CmdDel_Click() DataA.ReadOnly = False DataA.Recordset.Delete DataA.Recordset.MoveNext If DataA.Recordset.EOF Then DataA.Recordset.MoveLast End If FrmMain.DataA.Refresh End Sub Private Sub cmdOK_Click() If Txt(0).Text = "" Then MsgBox "不可以为空" Txt(0).SetFocus Exit Sub End If Bupdata = False DataA.Recordset.Edit If FrmMain.cutable = "leave" Then DataA.Recordset.Fields(8) = frmLogin.EmploID DataA.Recordset.Fields(9) = Now ElseIf FrmMain.cutable = "employee" Then DataA.Recordset.Fields(13) = frmLogin.EmploID DataA.Recordset.Fields(14) = Now If Opsex(0) Then DataA.Recordset.Fields(4) = "男" Else DataA.Recordset.Fields(4) = "女" End If DataA.Recordset.Fields(7) = Cmbdegree.Text DataA.Recordset.Fields(8) = Cmbdepart.Text DataA.Recordset.Fields(13) = frmLogin.EmploID DataA.Recordset.Fields(14) = Now Else For i = 4 To 10 If Not IsNumeric(Txt(i).Text) Then MsgBox "not a number" Txt(i).SetFocus Exit Sub End If Next i DataA.Recordset.Fields(13) = frmLogin.EmploID DataA.Recordset.Fields(14) = Now End If For i = 1 To 12 If Txt(i).Text = "" Then Txt(i).Text = 0 'DataA.Recordset.Fields(i) = 0 Next i DataA.Recordset.Update FrmMain.DataA.Refresh DataB.Refresh End Sub Private Sub DataA_Validate(Action As Integer, Save As Integer) If Action = 11 And Bupdata Then Save = 0 End If End Sub Private Sub Lab_Click(Index As Integer) End Sub Private Sub Txt_KeyPress(Index As Integer, KeyAscii As Integer) If (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> vbKeyBack And Index = 0 Then KeyAscii = 0 Exit Sub End If If FrmMain.cutable = "leave" And Index = 1 Then If (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> vbKeyBack Then KeyAscii = 0 Exit Sub End If End If If FrmMain.cutable = "salary" Then If Index <= 3 Then If (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> vbKeyBack Then KeyAscii = 0 Exit Sub End If End If If Index = 13 Then Exit Sub If (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> vbKeyBack And KeyAscii <> 46 Then KeyAscii = 0 Exit Sub End If End If End Sub Private Sub Txt_change(Index As Integer) If Bupdata = False Then Bupdata = True If FrmMain.cutable = "salary" Then If Txt(Index).Text = "" Then Exit Sub If Index >= 4 And Index <= 6 Then Txt(7).Text = Val(Txt(4).Text) + Val(Txt(5).Text) + Val(Txt(6).Text) Txt(12).Text = Val(Txt(7).Text) - Val(Txt(11).Text) End If If Index >= 8 And Index <= 10 Then Txt(11).Text = Val(Txt(8).Text) + Val(Txt(9).Text) + Val(Txt(10).Text) Txt(12).Text = Val(Txt(7).Text) - Val(Txt(11).Text) End If End If End Sub Private Sub Form_Load() DataA.DatabaseName = App.Path + "\sm.mdb" DataB.DatabaseName = App.Path + "\sm.mdb" DataA.Caption = FrmMain.cutable DataA.RecordSource = "select * from " + FrmMain.cutable DataB.RecordSource = "select * from " + FrmMain.cutable DataA.Refresh Txt(0).Locked = True 'If FrmMain.DBGA.Row = 0 Then Exit Sub If FrmMain.cutable = "employee" Then 'employee For i = 0 To 12 Lab(i).Caption = DataA.Recordset.Fields(i).Name Next i Txt(0).DataField = DataA.Recordset.Fields(0).Name Txt(1).DataField = DataA.Recordset.Fields(1).Name Txt(2).DataField = DataA.Recordset.Fields(2).Name Txt(3).DataField = DataA.Recordset.Fields(3).Name Txt(4).Visible = False Txt(5).DataField = DataA.Recordset.Fields(5).Name Txt(6).DataField = DataA.Recordset.Fields(6).Name Txt(7).Visible = False Txt(8).Visible = False Txt(9).DataField = DataA.Recordset.Fields(9).Name Txt(10).DataField = DataA.Recordset.Fields(10).Name Txt(11).DataField = DataA.Recordset.Fields(11).Name Txt(12).DataField = DataA.Recordset.Fields(12).Name Txt(13).DataField = DataA.Recordset.Fields(15).Name If FrmMain.cuAp > -1 Then DataA.Recordset.Move (FrmMain.cuAp) Else DataA.Recordset.MoveFirst End If If DataA.Recordset.Fields(4) = "男" Then Opsex(0).Value = True Else Opsex(1).Value = True End If '设置lsdegree的显示项 For i = 0 To FrmMain.LsDegree.ListCount - 2 Cmbdegree.AddItem FrmMain.LsDegree.List(i) If FrmMain.LsDegree.List(i) = DataA.Recordset.Fields(7) Then Cmbdegree.ListIndex = i End If Next i If Cmbdegree.ListIndex = -1 Then Cmbdegree.AddItem DataA.Recordset.Fields(7) Cmbdegree.ListIndex = Cmbdegree.ListCount - 1 End If Cmbdegree.AddItem "定制" '设置lsdepart的显示项 For i = 0 To FrmMain.LsDepart.ListCount - 2 Cmbdepart.AddItem FrmMain.LsDepart.List(i) If FrmMain.LsDepart.List(i) = DataA.Recordset.Fields(8) Then Cmbdepart.ListIndex = i End If Next i If Cmbdepart.ListIndex = -1 Then Cmbdepart.AddItem DataA.Recordset.Fields(8) Cmbdepart.ListIndex = Cmbdepart.ListCount - 1 End If Cmbdepart.AddItem "定制" '设置完毕 ElseIf FrmMain.cutable = "leave" Then 'leave Txt(7).Visible = True Cmbdegree.Visible = False Cmbdepart.Visible = False Frame1.Visible = False For i = 8 To 12 Lab(i).Visible = False Txt(i).Visible = False Next i For i = 0 To 7 Lab(i).Caption = DataA.Recordset.Fields(i).Name Txt(i).DataField = DataA.Recordset.Fields(i).Name Next i Txt(13).DataField = DataA.Recordset.Fields(10).Name If FrmMain.cuAp > -1 Then DataA.Recordset.Move (FrmMain.cuAp) Else DataA.Recordset.MoveFirst End If Else 'salary Frame1.Visible = False Cmbdegree.Visible = False Cmbdepart.Visible = False For i = 0 To 12 Lab(i).Caption = DataA.Recordset.Fields(i).Name Txt(i).DataField = DataA.Recordset.Fields(i).Name Next i Txt(13).DataField = DataA.Recordset.Fields(15).Name Txt(7).Locked = True Txt(11).Locked = True Txt(12).Locked = True If FrmMain.cuAp > -1 Then DataA.Recordset.Move (FrmMain.cuAp) Else DataA.Recordset.MoveFirst End If End If End Sub Private Sub Form_Unload(Cancel As Integer) FrmMain.Enabled = True FrmMain.SetFocus Unload Me FrmMain.DataB.Refresh End Sub Option Explicit Const MxUser = 100 Public EmploID As Integer Public CurUser As String Public CurId As String Public CurPsw As String Dim user(MxUser), pws(MxUser), state(MxUser), Emplo(MxUser) As String Private Sub Form_Load() Dim i As Integer If App.PrevInstance Then MsgBox ("程序已经运行,不能再次装载。"), vbExclamation Unload Me End If '本段代码用于判定本程序是否已经装载于内存中,以避免程序的多重启动 i = 0 Open App.Path + "\user.ini" For Input As #1 Do While Not EOF(1) Input #1, user(i), pws(i), state(i), Emplo(i) If state(i) = "A" Then Combo1.AddItem user(i) End If i = i + 1 Loop Close #1 Combo1.ListIndex = 1 '在窗口装载阶段读取用户设置文件获取用户信息 并装载于用户列表框中 End Sub Private Sub CmdCancel_Click() Unload Me End End Sub Private Sub cmdOK_Click() If txtPassword = pws(Combo1.ListIndex) Then CurId = Combo1.ListIndex EmploID = Emplo(CurId) CurUser = user(CurId) CurPsw = pws(CurId) Me.Hide 'Load FrmMain FrmMain.Show Else MsgBox "Invalid Password, try again!", , "Login" txtPassword.SetFocus SendKeys "{Home}+{End}" End If End Sub Private Sub Form_Unload(Cancel As Integer) Unload Me End ...展开收缩
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.