资源预览内容
第1页 / 共37页
第2页 / 共37页
第3页 / 共37页
第4页 / 共37页
第5页 / 共37页
第6页 / 共37页
第7页 / 共37页
第8页 / 共37页
第9页 / 共37页
第10页 / 共37页
亲,该文档总共37页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
模块1:Option ExplicitPublic con As ADODB.ConnectionPublic rs As ADODB.RecordsetPublic username As StringPublic usergrade As StringPublic userpwd As StringPublic cmd As ADODB.Command模块2Option ExplicitSub hidewindow() With ActiveWindow .DisplayGridlines = False .DisplayHeadings = False .DisplayOutline = False .DisplayZeros = False .DisplayHorizontalScrollBar = False .DisplayVerticalScrollBar = False .DisplayWorkbookTabs = False End WithEnd SubSub showwindow() With ActiveWindow .DisplayGridlines = True .DisplayHeadings = True .DisplayOutline = True .DisplayZeros = True .DisplayHorizontalScrollBar = True .DisplayVerticalScrollBar = True End WithEnd Sub模块3:Sub Macro1() Range(D2:D60000).Select With Selection.Validation .Delete .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _ xlBetween, Formula1:=团员,党员,预备党员,群众 .IgnoreBlank = True .InCellDropdown = True .InputTitle = .ErrorTitle = .InputMessage = .ErrorMessage = .IMEMode = xlIMEModeNoControl .ShowInput = True .ShowError = True End With End SubSub Macro2() Range(J2:J60000).Select With Selection.Validation .Delete .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _ xlBetween, Formula1:=本科,专科 .IgnoreBlank = True .InCellDropdown = True .InputTitle = .ErrorTitle = .InputMessage = .ErrorMessage = .IMEMode = xlIMEModeNoControl .ShowInput = True .ShowError = True End With End SubSub Macro3() Range(K2:K60000).Select With Selection.Validation .Delete .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _ xlBetween, Formula1:=在校,休学,毕业 .IgnoreBlank = True .InCellDropdown = True .InputTitle = .ErrorTitle = .InputMessage = .ErrorMessage = .IMEMode = xlIMEModeNoControl .ShowInput = True .ShowError = True End With End SubUserForm1代码:Option ExplicitPrivate Sub CommandButton1_Click()On Error GoTo doerrorDim sql As StringSet con = New ADODB.ConnectionSet rs = New ADODB.Recordsetcon.Open Provider=Microsoft.Jet.OLEDB.4.0;Data source= & ThisWorkbook.Path & xjcj.mdbsql = select * from 用户数据表 where 用户名= & UserForm1.ComboBox1.Text & rs.Open sql, con, adOpenKeyset, adLockOptimisticIf UserForm1.ComboBox1.Text = Then MsgBox 用户名不能为空! UserForm1.ComboBox1.SetFocus Exit SubEnd IfIf UserForm1.TextBox2.Text = Then MsgBox 密码不能为空! UserForm1.TextBox2.SetFocus Exit SubEnd IfIf Trim(rs.Fields(密码) = Trim(UserForm1.TextBox2.Text) Then username = Trim(rs.Fields(用户名) usergrade = Trim(rs.Fields(权限) userpwd = Trim(rs.Fields(密码) Workbooks.Application.Visible = True Sheets(目录).Activate Me.Hide Unload MeElse MsgBox 密码错误 TextBox2.Text = TextBox2.SetFocusExit SubEnd Ifrs.Closecon.CloseSet rs = NothingSet con = NothingExit Subdoerror:MsgBox 系统出现错误End SubPrivate Sub CommandButton2_Click()ActiveWorkbook.SaveApplication.QuitEnd SubPrivate Sub UserForm_Initialize()Dim i As IntegerSet con = New ADODB.ConnectionSet rs = New ADODB.Recordsetcon.Open Provider=Microsoft.Jet.OLEDB.4.0;Data source= & ThisWorkbook.Path & xjcj.mdbrs.Open select * from 用户数据表 , con, adOpenKeyset, adLockOptimisticFor i = 1 To rs.RecordCountUserForm1.ComboBox1.AddItem rs.Fields(用户名)rs.MoveNextNext irs.Closecon.CloseSet rs = NothingSet con = NothingEnd SubUserForm2代码:Option ExplicitPrivate Sub CommandButton1_Click()On Error Resume NextApplication.ScreenUpdating = FalseDim sql As StringSet con = New ADODB.ConnectionSet rs = New ADODB.RecordsetSet cmd = New ADODB.Commandcon.Open Provider=Microsoft.Jet.OLEDB.4.0;Data source= & ThisWorkbook.Path & xjcj.mdbSet cmd.ActiveConnection = conIf UserForm2.TextBox1.Text = Or UserForm2.TextBox2.Text = Or UserForm2.TextBox3.Text = Then MsgBox 更改信息不齐全!, 48 Exit Sub End IfIf userpwd = Trim(UserForm2.TextBox1.Text) Then If Trim(UserForm2.TextBox2) = Trim(UserForm2.TextBox3) Then cmd.CommandText = update 用户数据表 set 密码= & UserForm2.TextBox2.Text & where 用户名= & username & cmd.Execute MsgBox 密码更换成功!请牢记密码! Unload Me Else MsgBox 确认密码输入有误,请重新输入! UserForm2.TextBox3.SetFocus End IfElse MsgBox 原密码输入错误,请重新输入! UserForm2.TextBox1.SetFocus End I
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号