【文章內(nèi)容簡介】
Click()End SubPrivate Sub yihu_Click() = 1End Sub4. 備份界面設計::備份代碼設計:Private Sub Command1_Click()Dim a As Stringa = a = a amp。 \b = 39。On Error GoTo errhandle:Dim filename As Stringfilename = amp。 amp。 If a = ThenMsgBox 備份目錄與原文件目錄相同,請重新選擇!Exit SubEnd IfIf Dir( amp。 b amp。 ) ThenDim llp As Stringllp = MsgBox(此目錄下已有該文件,要覆蓋嗎?, vbYesNo, 備份文件)If llp = vbYes ThenKill ( amp。 b amp。 )FileCopy amp。 a amp。 \data\, amp。 b amp。 Dim ll = MsgBox( 備份成功! , vbOKOnly, 提示)ElseExit SubEnd IfElseFileCopy amp。 a amp。 \data\, amp。 b amp。 Dim llll = MsgBox( 備份成功! , vbOKOnly, 提示)End IfExit Sub39。errhandle:39。MsgBox 出現(xiàn)錯誤,不能復制, vbOKOnly + vbCritical, 復制文件39。Resume NextEnd SubPrivate Sub Command2_Click()39。dy39。Unload MeEnd SubPrivate Sub Dir1_Change()39。 = Dir1If Right(, 1) \ Then = + \Else = End If = TrueEnd SubPrivate Sub Dir1_Click()If Right(, 1) \ Then = + \Else = End If = TrueEnd SubPrivate Sub Drive1_Change() = End SubPrivate Sub Form_Activate() = FalseChDrive ChDir 39。39。 = c:\ = CurDir() = FalseEnd SubPrivate Sub Form_Load()ChDrive ChDir End SubPrivate Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)dyEnd SubPrivate Sub Form_Unload(Cancel As Integer)If = 0 Then = Provider=。Jet OLEDB:database password= amp。 DbPassword amp。 。Data Source= amp。 _ amp。 \data\。Persist Security Info=False = adUseClient End IfEnd Sub5. 單戶抄表界面設計:單戶抄表代碼設計:Private Sub Command2_Click() Dim n As New Dim rstE As New Dim cmdExe As New Dim nowEv As Double Dim sqlAdd As String If Trim(txtUserName(0).Text) = Then MsgBox 沒有要抄表用戶,請先添加用戶! , vbInformation Exit Sub End If If Trim(txtUserName(9).Text) = Then MsgBox 請先輸入數(shù)據(jù)! , vbInformation Exit Sub End If If Trim(txtUserName(9).Text) Trim(txtUserName(2).Text) Then MsgBox 輸入數(shù)據(jù)錯誤,當前止碼太??! , vbInformation Exit Sub End If = Provider=。Jet OLEDB:database password= amp。 DbPassword amp。 。Data Source= amp。 _ amp。 \data\。Persist Security Info=False = adUseClient = n select nowecount from panelinfo where holderID= 39。 amp。 Trim(txtUserName(0)) amp。 39。, n, adOpenStatic, adLockBatchOptimistic nowEv = Val((0).Value) + (Val(txtUserName(9)) Val(txtUserName(2))) sqlAdd = update panelinfo set LEndPCode= amp。 Val(txtUserName(2).Text) amp。 ,cEndCode= amp。 Val(txtUserName(9).Text) amp。 ,nowEcount= amp。 nowEv amp。 ,writedate= amp。 dtpwdate(1) amp。 where holderID= 39。 amp。 Trim(txtUserName(0)) amp。 39。 = sqlAdd sqlAdd 39。 sqlAdd txtUserName(2).Text = txtUserName(9) txtUserName(9) = MsgBox 數(shù)據(jù)保存完成! , vbInformation Unload Me End SubPrivate Sub Form_Load()Dim rst As New Dim sqlEdit As Stringdtpwdate(1).Value = Format(Now, yyyymmdd)sqlEdit = select * from panelinfo sqlEdit = sqlEdit amp。 where holderid=39。 amp。 Trim((0)) amp。 39。and delflagtrue sqlEdit, gCnn, adOpenStatic, adLockBatchOptimistic If Not Then txtUserName(0) = (1) txtUserName(1) = (2) txtUserName(2) = !cendcode dtpwdate(0).Value = (4) End Ifbuttontime = FalseEnd SubPrivate Sub Form_Unload(Cancel As Integer) (txtUserName(0))Cancel = 0End SubPrivate Sub nextuser_Click() Dim rst As New Dim sqlEdit As StringsqlEdit = select * from panelinfo sqlEdit = sqlEdit amp。 where holderid39。 amp。 Trim(txtUserName(0)) amp。 39。and delflagtrue sqlEdit, gCnn, adOpenStatic, adLockBatchOptimistic If buttontime = False Then If Not Then txtUserName(0) = (1) txtUserName(1) = (2) txtUserName(2) = !cendcode dtpwdate(0).Value = (4) buttontime = True End IfElse If Not Then txtUserName(0) = (1) txtUserName(1) = (2) txtUserName(2) = !cendcode dtpwdate(0).Value = (4) buttontime = True End IfEnd IfEnd SubPrivate Sub txtUserName_KeyPress(Index As Integer, KeyAscii As Integer)If Index = 9 Then If KeyAscii 8 And KeyAscii 46 And KeyAscii 48 Or KeyAscii 57 Then KeyAscii = 0End IfEnd Sub6. 數(shù)據(jù)導入界面設計:數(shù)據(jù)導入代碼設計:Private Sub Command1_Click()On Error GoTo errhandle:Dim a As Stringa = a = a amp。 \b = Dim filename As StringIf Dir( amp。 a amp。 ) ThenDim ll As Stringll = MsgBox(此目錄下有此文件要覆蓋嗎, vbYesNo, 復制文件)If ll = vbYes ThenKill ( amp。 a amp。 )FileCopy amp。 amp。 , amp。 a amp。 Dim ll = MsgBox(數(shù)據(jù)導入成功, vbOKOnly, 提示)ElseExit SubEnd IfElseFileCopy amp。 amp。 , amp。 a amp。 Dim llpllp = MsgBox(數(shù)據(jù)導入成功, vbOKOnly, 提示)End IfExit Suberrhandle:MsgBox 出現(xiàn)錯誤,不能復制, vbOKOnly + vbCritical, 復制文件End SubPrivate Sub Command2_Click()dyUnload MeEnd SubPrivate Sub Dir1_Change()If Right(, 1) \ Then = + \Else = End If = End SubPrivate Sub Drive1_Change()If = a: ThenMsgBox 不能從A盤導入Exit SubEnd If = End SubPrivate Sub File1_Click() = + = TrueEnd SubPrivate Sub Form_Activate() = False39。 = c:\ = CurDir() = FalseEnd SubPrivate Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)dyUnload MeEnd SubPrivate Sub Form_Unload(Cancel As Integer)If = 0 Then = Provider=。Jet OLEDB:database password= amp。 DbPassword amp。 。Data Source= amp。 _ amp。 \data\。Persist Security Info=False = adUseClient End IfEnd Sub7. 數(shù)據(jù)刪除界面設計:數(shù)據(jù)刪除代碼設計:Private Sub cmdAsure_Click() If MsgBox( 你確定要刪除該數(shù)據(jù)嗎? , vbInformation + vbYesNo) vbYes Then Exit