?? frmmuchvillage.frm
字號:
Input #1, TempStr
With tempDBF
.AddNew
.Fields!Txstr = TempStr
.Update
End With
ik = ik + 1
Progress.Value = ik
Loop
Close #1
Set tempDBF0 = NdMd.OpenRecordset("Temp0")
Progress.Max = tempDBF.RecordCount - 1
tempDBF.MoveFirst
For ik = 0 To tempDBF.RecordCount - 1
With tempDBF0
.AddNew
.Fields!tempstru = Mid(tempDBF.Fields!Txstr, 1, 32)
.Update
.AddNew
.Fields!tempstru = Mid(tempDBF.Fields!Txstr, 33, 32)
.Update
End With
tempDBF.MoveNext
Progress.Value = ik
Next
NdMd.Execute "DELETE * From Temp0 where tempstru='FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF'"
Set tempDBF0 = NdMd.OpenRecordset("SELECT * FROM Temp0 WHERE Mid(tempstru,5,1)<>'F'")
tempDBF0.MoveLast
Dim PublicCound As Integer
PublicCound = tempDBF0.RecordCount - 1
Set MdbR = NdMd.OpenRecordset("SendMdb")
tempDBF0.MoveFirst
Progress.Value = 0
Progress.Min = 0
Progress.Max = tempDBF0.RecordCount - 1
For I = 0 To tempDBF0.RecordCount - 1
If Mid(tempDBF0.Fields!tempstru, 1, 4) = Mid(GzNian, 3, 2) & GzYue Then
With MdbR
.AddNew
.Fields!區號 = Mid(tempDBF0.Fields!tempstru, 5, 6)
.Fields!戶數 = Mid(tempDBF0.Fields!tempstru, 15, 4)
.Fields!抄錄戶數 = Mid(tempDBF0.Fields!tempstru, 19, 4)
.Fields!下載戶數 = Mid(tempDBF0.Fields!tempstru, 23, 4)
.Update
End With
End If
Progress.Value = I
tempDBF0.MoveNext
Next
Set tempDBF = NdMd.OpenRecordset("Temp0")
Progress.Value = 0
Progress.Min = 0
Progress.Max = tempDBF.RecordCount
For I = 1 To tempDBF.RecordCount
tempDBF.Edit
tempDBF.Fields!ID = I
tempDBF.Update
tempDBF.MoveNext
Progress.Value = I
Next
NdMd.Execute "DELETE * From Temp0 WHERE id=1" '刪除第一行無效
NdMd.Execute "DELETE * From Temp0 WHERE id=2" '刪除第二行無效
Set tempDBF0 = NdMd.OpenRecordset("SendMdb")
Dim RqQh As String
For I = 1 To tempDBF0.RecordCount
RqQh = tempDBF0.Fields!區號
NdMd.Execute "DELETE * From Temp0 WHERE left(temp0.tempstru,10)='" & Right(GzNian, 2) & GzYue & RqQh & "'" '刪除所有不是用戶信息的紀錄
tempDBF0.MoveNext
Next
' Set tempDBF = NdMd.OpenRecordset("Temp0")
' Set tempDBF0 = NdMd.OpenRecordset("SendMdb")
'編號
Progress.Value = 0
Progress.Min = 0
Progress.Max = tempDBF.RecordCount
tempDBF.MoveFirst
For I = 1 To tempDBF.RecordCount
tempDBF.Edit
tempDBF.Fields!ID = I
tempDBF.Update
tempDBF.MoveNext
Progress.Value = I
Next
Dim jgf As Integer, JH As Integer
Dim qdm As String, SqlLoca As String
jgf = 0
If tempDBF0.RecordCount <> 0 Then
tempDBF0.MoveFirst
End If
Progress1.Value = 0
Progress1.Min = 0
Progress1.Max = tempDBF0.RecordCount
For I = 0 To tempDBF0.RecordCount - 1
qdm = tempDBF0.Fields!區號
jgf = Val(tempDBF0.Fields!戶數)
'創建記錄
SqlLoca = "SELECT temp0.* INTO tempmdb From temp0 WHERE temp0.id>=1 and temp0.id<= " & jgf & ""
NdMd.Execute SqlLoca
'刪除記錄
SqlLoca = "DELETE * FROM temp0 WHERE id>=1 and id<=" & jgf & ""
NdMd.Execute SqlLoca
'重新編號
Set tempDBF = NdMd.OpenRecordset("Temp0")
If tempDBF.RecordCount <> 0 Then
tempDBF.MoveFirst
Progress.Value = 0
Progress.Min = 0
Progress.Max = tempDBF.RecordCount
For JH = 1 To tempDBF.RecordCount
tempDBF.Edit
tempDBF.Fields!ID = JH
tempDBF.Update
tempDBF.MoveNext
Progress.Value = JH
Next
End If
'開始入庫
Set tempDBF = NdMd.OpenRecordset("TempMdb")
If tempDBF.RecordCount <> 0 Then
tempDBF.MoveLast
tempDBF.MoveFirst
Progress.Min = 0
Progress.Value = 0
Progress.Max = tempDBF.RecordCount - 1
For ik = 0 To Progress.Max
'If ik = 90 Then Stop
Set MdbR = NdMd.OpenRecordset("SELECT 用戶電費.鎮村代碼,用戶電費.輔助號,用戶電費.狀態,用戶電費.用戶類型,用戶電費.多表序號,用戶電費.抄表碼,用戶電費.組合編碼,用戶電費.[" & AA & "] AS 本期示數,用戶電費.[" & VV & "] AS 抄表時間,用戶電費.相數標識 From 用戶電費 WHERE 用戶電費.抄表碼='" & Mid(tempDBF.Fields!tempstru, 7, 6) & "' and 用戶電費.鎮村代碼='" & qdm & " 'order by 用戶電費.抄表碼 asc")
If MdbR.RecordCount <> 0 Then
If Mid(tempDBF.Fields!tempstru, 19, 1) <> "F" Then
With MdbR
.Edit
.Fields!本期示數 = Mid(tempDBF.Fields!tempstru, 19, 6)
.Fields!抄表時間 = Mid(tempDBF.Fields!tempstru, 31, 2) & "日" & Mid(tempDBF.Fields!tempstru, 29, 2) & "時" & Mid(tempDBF.Fields!tempstru, 27, 2) & "分" & Mid(tempDBF.Fields!tempstru, 25, 2) & "秒"
.Update
End With
End If
End If
tempDBF.MoveNext
Progress.Value = ik
DoEvents
Next
tempDBF.Close
NdMd.Execute "DROP TABLE tempmdb"
Progress1.Value = I
tempDBF0.MoveNext
Else
tempDBF.Close
NdMd.Execute "DROP TABLE tempmdb"
End If
Next
Progress.Value = 0
Progress1.Value = 0
Command7.Enabled = True
MsgBox "數據入庫工作處理完畢,請計算電費!", vbInformation
Screen.MousePointer = 1
Exit Sub
CommClicE:
If Err.Number = 3010 Then
NdMd.Execute "DROP TABLE tempmdb"
MsgBox Err.Description & "本次失敗!", vbCritical
Command7.Enabled = True
Progress1.Value = 0
Progress.Value = 0
Screen.MousePointer = 0
Exit Sub
End If
End Sub
Private Sub Form_Load()
Dim intRecCount, intCounter As Integer
On Error Resume Next
Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2 ' 2
If Trim(Str(QueryValue(HKEY_CURRENT_USER, "Software\VB and VBA Program Settings\Nx3DataTransmit\其他", "ExitData"))) = "1" Then
Check3.Value = 1
Else
Check3.Value = 0
End If
If Trim(Str(QueryValue(HKEY_CURRENT_USER, "Software\VB and VBA Program Settings\Eps\SysSetup", "XsTag"))) = "1" Then
Check2.Value = 1
RegVal = True
Else
Check2.Value = 0
RegVal = False
End If
If Trim(Str(QueryValue(HKEY_CURRENT_USER, "Software\VB and VBA Program Settings\Eps\SysSetup", "NoTag"))) = "1" Then
Check4.Value = 1
Check2.Value = 0
NoTag = True
Else
Check4.Value = 0
NoTag = False
End If
If FileExists(App.Path & "\SendTx.txt") Then
Kill App.Path & "\SendTx.txt"
End If
If FileExists(App.Path & "\ReveTx.txt") Then
Kill App.Path & "\ReveTx.txt"
End If
Command2.Enabled = False
Image2.Visible = False
'Command1.Enabled = False
OpenMdb
Set MdbR = NdMd.OpenRecordset("鄉鎮檔案")
MdbR.MoveLast
intCounter = MdbR.RecordCount
MdbR.MoveFirst
For intRecCount = 0 To intCounter - 1
List1.AddItem& MdbR.Fields("鎮代碼") & " " & MdbR.Fields("簡稱") & ""
MdbR.MoveNext
Next intRecCount
List1.ListIndex = 0
Command6.Enabled = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
MdbR.Close
NdMd.Close
End Sub
Private Sub List1_Click()
Dim intRecCount, intCounter As Integer
Dim Nd As Recordset
On Error Resume Next
Set MdbR = NdMd.OpenRecordset("SELECT 村代碼,簡稱 FROM 村檔案 WHERE 村檔案.鎮代碼 ='" & Mid(Trim(List1.Text), 1, 3) & "'")
MdbR.MoveLast
intCounter = MdbR.RecordCount
MdbR.MoveFirst
List2.Clear
For intRecCount = 0 To intCounter - 1
Set Nd = NdMd.OpenRecordset("SELECT count(*)as zsh FROM 用戶電費 WHERE 用戶電費.鎮村代碼= '" & Mid(Trim(List1.Text), 1, 3) & Trim(MdbR.Fields("村代碼")) & "'")
List2.AddItem& MdbR.Fields("村代碼") & " " & MdbR.Fields("簡稱") & " " & Nd.Fields!zsh & "只表"
MdbR.MoveNext
Next intRecCount
List2.ListIndex = 0
End Sub
Private Sub List2_Click()
Dim j As Integer, k As Integer, l As Integer
For j = 0 To List2.ListCount - 1
If List2.Selected(j) Then
k = k + 1
If k > 0 Then
Command2.Enabled = True
Else
Command2.Enabled = False
End If
Else
If k > 0 Then
Command2.Enabled = True
Else
Command2.Enabled = False
End If
End If
Next
List2.ListIndex = 0
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -