📄 amenduser.frm
字号:
If Len(Combo1(Index).Text) = 4 Then
Dim GetItem As String
Dim Dresult As Boolean
For Deng = 0 To Combo1(Index).ListCount - 1
GetItem = Left(Combo1(Index).List(Deng), Len(Combo1(Index).Text))
Dresult = (Combo1(Index).Text = GetItem)
If Dresult Then Combo1(Index).ListIndex = Deng: Exit For
Next Deng
End If
End If
End Sub
Private Sub Combo1_KeyPress(Index As Integer, KeyAscii As Integer)
If KeyAscii = 13 Then
Call Combo1_Click(Index)
End If
End Sub
Private Sub Combo2_Click(Index As Integer)
On Error Resume Next
Select Case Index
Case 0
Text1(9).Visible = True
If GetSetting(App.EXEName, "SysSetup", "TqInfo", "") = "0" Then Text1(9) = Combo2(0).Text
If GetSetting(App.EXEName, "SysSetup", "TqInfo", "") = "1" Then Text1(9) = convert_Num(Combo2(0).Text)
If GetSetting(App.EXEName, "SysSetup", "TqInfo", "") = "2" Then Text1(9) = convert_string(Combo2(0).Text)
Combo2(0).Visible = False
Case 1
Text1(10).Visible = True
Text1(10).Text = conv_str(Trim(Mid(Combo2(Index).Text, 3, Val(InStr(Combo2(Index).Text, "|")) - 3))) ' PriceStr(Mid(Combo2(Index).Text, 1, Len(Combo2(Index)) - 14), ".")
Text2.Text = PriceStr(Combo2(Index).Text, ".")
Case 2
Text1(15).Visible = True
Text1(15).Text = Combo2(Index).Text
Case 3
Text1(16).Visible = True
Text1(16).Text = Combo2(Index).Text
Case 4
Text1(18).Visible = True
Text1(18).Text = Combo2(Index).Text
Case 5
Text1(19).Visible = True
Text1(19).Text = Combo2(Index).Text
Case 6
Text1(20).Visible = True
Text1(20).Text = Combo2(Index).Text
Case 7
Text1(21).Visible = True
Text1(21).Text = Combo2(Index).Text
Case 8
Text1(22).Visible = True
Text1(22).Text = Combo2(Index).Text
Case 9
Text1(23).Visible = True
Text1(23).Text = Combo2(Index).Text
End Select
Combo2(Index).Visible = False
End Sub
Private Sub Combo3_Click()
Text1(24) = Combo3.Text
If Combo3.Text = "普通照明" Then
Text1(8) = 1
Text1(13) = 1
Else
Text1(8) = 3
End If
Combo3.Visible = False
End Sub
Private Sub DTPicker1_Change()
Toolbar1.Buttons(1).Enabled = True
End Sub
Private Sub Form_Load()
Dim I As Integer
On Error GoTo LoadErr
For I = 0 To 9
Combo2(I).Visible = False
Next
Toolbar1.Buttons(1).Enabled = False
Toolbar2.Buttons(1).Enabled = False
Toolbar3.Buttons(1).Enabled = False
' Toolbar3.Visible = False
Toolbar5.Visible = False
Toolbar6.Visible = False
Toolbar7.Visible = False
Toolbar8.Visible = False
DTPicker1.Enabled = False
Combo3.AddItem "普通照明"
Combo3.AddItem "工业动力"
Combo3.Visible = False
Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 1 - 900
OpenMdb
Set MdbR = NdMd.OpenRecordset("SELECT DISTINCT 用户编码 from 用户电费 where 镇村代码 ='" & UserSeek & "' ORDER BY 用户编码 ASC")
With MdbR
If .RecordCount > 0 Then
.MoveLast
.MoveFirst
While Not .eof
Combo1(0).AddItem .Fields!用户编码
.MoveNext
Wend
Combo1(0).ListIndex = 0
End If
End With
Option1.Value = True
For I = 0 To 24
Text1(I).Enabled = False
Next
Text3.Enabled = False
Exit Sub
LoadErr:
MsgBox Err.Description, vbCritical
Exit Sub
End Sub
Private Sub Combo1_Click(Index As Integer)
Dim I As Integer
Dim node1 As node
Dim node2 As node
On Error GoTo CombClickE
TreeView1.Nodes.Clear
Select Case Index
Case 0
Set MdbR = NdMd.OpenRecordset("select 多表序号,抄表码,用户类型,用户名称,组合编码,用户电费.标签,用户电费.相数标识 from 用户电费 where 组合编码 ='" & UserSeek & Format(Combo1(Index).Text, "0000") & "' ORDER BY 多表序号 ASC")
Case 1
Set MdbR = NdMd.OpenRecordset("select 多表序号,抄表码,用户类型,用户名称,用户电费.标签,用户电费.相数标识 from 用户电费 where 用户名称 ='" & Combo1(Index).Text & "' and 镇村代码='" & UserSeek & "' ORDER BY 多表序号 ASC")
End Select
If MdbR.eof = False Then
With MdbR
.MoveLast
.MoveFirst
Select Case .Fields!用户类型
Case "普通照明"
Set node1 = TreeView1.Nodes.Add(, , , .Fields!用户名称 & "--->", 1)
Case "工业动力"
Set node1 = TreeView1.Nodes.Add(, , , .Fields!用户名称 & "--->", 1)
End Select
For I = 0 To .RecordCount - 1
If .Fields!用户类型 = "工业动力" Then
Set node2 = TreeView1.Nodes.Add(node1.Index, tvwChild, , .Fields!多表序号 & "." & .Fields!用户类型 & .Fields!相数标识 & "相", 2)
Else
Set node2 = TreeView1.Nodes.Add(node1.Index, tvwChild, , .Fields!多表序号 & "." & .Fields!用户类型, 2)
End If
.MoveNext
Next
End With
node1.Expanded = True
node2.EnsureVisible
'-------------------------------------------------------------list
' 加载标记
'Set MdbR = NdMd.OpenRecordset("SELECT 用户电费.组合编码, 用户电费.用户名称, 用户电费.全称,用户电费.地址, 用户电费.电话, 用户电费.开户银行,用户电费.账号, 用户电费.表卡号, 用户电费.分帐号,用户电费.台区, 用户电费.电价类别, 用户电费.[" & AAA & "] as 上期示数,用户电费.[" & AA & "] as 本期示数, 用户电费.倍率,表计档案.局编号码,表计档案.型号,表计档案.厂家,表计档案.编号,表计档案.相数,表计档案.电压,表计档案.电流,表计档案.精度,表计档案.常数,表计档案.性能,用户电费.多表序号,表计档案.装表日期,用户电费.用户类型 FROM 用户电费 INNER JOIN 表计档案 ON 用户电费.组合编码 = 表计档案.组合编码 WHERE 用户电费.组合编码='" & Trim(Combo1(0).Text) & "' and 用户电费.多表序号='1' ORDER BY 用户电费.多表序号")
'If MdbR.eof = False Then
' With MdbR
' For i = 0 To 23
' Text1(i).Tag = .Fields(i) & ""
' Text1(i).Text = .Fields(i) & ""
' Next
' DTPicker1.Value = .Fields(25) & ""
' For i = 0 To 23
' Text1(i).Enabled = True
' Next
' Text1(24) = .Fields(26)
' DTPicker1.Enabled = True
' Toolbar2.Buttons(1).Enabled = True
' Toolbar3.Buttons(1).Enabled = True
' End With
'Else
' For i = 0 To 23
' Text1(i).Enabled = False
' Next
' DTPicker1.Enabled = False
' Toolbar2.Buttons(1).Enabled = False
' Toolbar3.Buttons(1).Enabled = False
'End If
Else
MsgBox "无此用户,请检查是否有此代码的用户!", vbCritical
Toolbar1.Buttons(1).Enabled = False
Toolbar2.Buttons(1).Enabled = False
Toolbar3.Buttons(1).Enabled = False
For I = 0 To 24
Text1(I).Tag = ""
Text1(I) = ""
Text1(I).Enabled = False
Next
'Text1(24).Enabled = False
DTPicker1.Enabled = False
Combo3.Enabled = False
Text3.Enabled = False
End If
Exit Sub
CombClickE:
MsgBox Err.Description, vbCritical
Exit Sub
End Sub
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
MdbR.Close
End Sub
Private Sub Option1_Click()
Combo1(0).Enabled = True
Combo1(1).Enabled = False
End Sub
Private Sub Option2_Click()
Combo1(1).Enabled = True
Combo1(0).Enabled = False
Set MdbR = NdMd.OpenRecordset("SELECT DISTINCT 用户名称 from 用户电费 where 镇村代码 ='" & UserSeek & "'")
With MdbR
If .RecordCount > 0 Then
.MoveLast
.MoveFirst
While Not .eof
Combo1(1).AddItem .Fields!用户名称 & ""
.MoveNext
Wend
End If
End With
End Sub
Private Sub Option3_Click()
Combo1(2).Enabled = True
Combo1(0).Enabled = False
Combo1(1).Enabled = False
End Sub
Private Sub Text1_Change(Index As Integer)
If Index = 12 Or Index = 11 Or Index = 13 Then
Call CheckIsNumber(Text1(Index))
End If
If Text1(Index).Tag <> Text1(Index).Text Then
Toolbar1.Buttons(1).Enabled = True
End If
End Sub
Private Sub Text1_GotFocus(Index As Integer)
On Error Resume Next
Select Case Index
Case 9
Toolbar5.Visible = True
Case 10
Toolbar6.Visible = True
Case 15
Toolbar7.Top = 495
Toolbar7.Left = 3105
Toolbar7.Visible = True
sVisble = 2
sNameID = 1
Case 16
Toolbar7.Top = 495
Toolbar7.Left = 6375
Toolbar7.Visible = True
sVisble = 3
sNameID = 2
Case 18
Toolbar7.Top = 810
Toolbar7.Left = 6375
Toolbar7.Visible = True
sVisble = 4
sNameID = 3
Case 19
Toolbar7.Top = 1200
Toolbar7.Left = 3105
Toolbar7.Visible = True
sVisble = 5
sNameID = 4
Case 20
Toolbar7.Top = 1185
Toolbar7.Left = 6375
Toolbar7.Visible = True
sVisble = 6
sNameID = 5
Case 21
Toolbar7.Top = 1530
Toolbar7.Left = 3105
Toolbar7.Visible = True
sVisble = 7
sNameID = 6
Case 22
Toolbar7.Top = 1515
Toolbar7.Left = 6375
Toolbar7.Visible = True
sVisble = 8
sNameID = 7
Case 23
Toolbar7.Top = 1860
Toolbar7.Left = 3105
Toolbar7.Visible = True
sVisble = 9
sNameID = 8
Case 24
Toolbar8.Visible = True
Case Else
End Select
Text1(Index).BackColor = &HC0FFC0
End Sub
Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
If KeyAscii = 13 Then
If Index = 12 Or Index = 11 Then
Select Case Index
Case 11
If Len(Text1(12)) <> 0 Then
If Val(Text1(11)) > Val(Text1(12)) Then
MsgBox "数据有误!", vbInformation
Exit Sub
End If
End If
Case 12
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -