📄 srbm.frm
字号:
Height = 255
Left = 360
TabIndex = 2
Top = 360
Width = 855
End
End
Attribute VB_Name = "srbm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public sj As Database
Public tmpsql As Recordset
Public xbchm, xbblm, blm, jjdlm, bshm As String
Public djm As Double
Private Sub Check2_Click()
If Not tmpsql.EOF And Not tmpsql.BOF Then
ab = tmpsql.Bookmark
string1(1) = tmpsql!byqh
string1(2) = tmpsql!Name
string1(3) = tmpsql!hh
string1(4) = tmpsql!byqh
string1(5) = tmpsql!sybm
string1(7) = tmpsql!bzm
string1(8) = tmpsql!bqm
string1(9) = tmpsql!bybm
If IsNull(xbchm) Or xbchm = "" Then
string1(6) = ""
Else
string1(6) = tmpsql!xbch
End If
lhbfrm.Show 1
If boolean1(1) Then
Text8.Enabled = True
Text9.Enabled = True
Text6 = string1(6)
Text8 = string1(4)
Text9 = string1(5)
xbchm = string1(2)
blm = string1(3)
Text6.SetFocus
tmpsql.Bookmark = ab
End If
End If
End Sub
Private Sub Check4_Click()
If Check4.Value = 1 Then
Check2.Visible = False
Else
Check2.Visible = True
End If
End Sub
Private Sub Command1_Click()
boolean1(2) = True
Command4.Enabled = True
Command2.Enabled = True
If Check1.Value = 1 Then
If IsNull(xbchm) Or xbchm = "" Then '换表与不换表的两种情况
cjdlm = Text6 - Text7
If Text6 < Text7 Then
cjdlm = IIf(Text6 < 1000, cjdlm + 1000, IIf(Text6 < 10000, cjdlm + 10000, IIf(Text6 < 100000, cjdlm + 100000, 0)))
End If
bydlm = cjdlm * blm
Else
ab1m = Text9 - Text7
ab2m = Text6 - Text8
If Text9 < Text7 Then
ab1m = IIf(Text7 < 1000, ab1m + 1000, IIf(Text7 < 10000, ab1m + 10000, IIf(Text7 < 100000, ab1m + 100000, 0)))
End If
If Text6 < Text8 Then
ab2m = IIf(Text8 < 1000, ab2m + 1000, IIf(Text8 < 10000, ab2m + 10000, IIf(Text8 < 100000, ab2m + 100000, 0)))
End If
bydlm = ab1m * blm + ab2m * xbblm
End If
dfm = (bydlm + jjdlm + bshm) * djm
End If
If Not tmpsql.BOF And Not tmpsql.EOF Then
tmpsql.Edit
tmpsql!hm = Text4
tmpsql!xbch = xbchm
tmpsql!xbbl = xbblm
tmpsql!bybm = Text6
tmpsql!bqm = Text8
tmpsql!bzm = Text9
If Check1.Value = 1 Then
tmpsql!bydl = bydlm + jjdlm + bshm
bydlm = bydlm + jjdlm + bshm
tmpsql!ysdf = dfm
End If
tmpsql.Update
If Check3.Value <> 1 Then
Label11.Caption = "电量:" + Str(bydlm) + "Kwh"
Label12.Caption = "电费:" + Str(dfm) + "元"
End If
tmpsql.MoveNext
End If
If Not tmpsql.EOF And Not tmpsql.BOF Then
Text1 = tmpsql!Name
Text2 = tmpsql!byqh
Text3 = tmpsql!hh
Text4 = tmpsql!hm
Text5 = tmpsql!ch
Text6 = tmpsql!bybm
Text7 = tmpsql!sybm
Text8 = tmpsql!bqm
Text9 = tmpsql!bzm
xbchm = tmpsql!xbch
xbblm = tmpsql!xbbl
djm = tmpsql!dj
blm = tmpsql!bl
jjdlm = tmpsql!jjdl
bshm = tmpsql!bsh
'MsgBox xbchm
If xbchm = "" Or IsNull(xbchm) Then
Text8.Enabled = False
Text9.Enabled = False
Else
Text8.Enabled = True
Text9.Enabled = True
End If
Text6.SetFocus
Else
Command1.Enabled = False
Command2.Enabled = False
Command4.Enabled = False
If tmpsql.BOF Then
Command1.Enabled = True
Command2.Enabled = False
Command4.Enabled = False
tmpsql.MoveNext
End If
End If
End Sub
Private Sub Command2_Click()
If srbm.Width = 3705 Then
srbm.Width = 6000
Command2.Caption = "无操作"
Else
srbm.Width = 3705
Command2.Caption = "操 作"
End If
End Sub
Private Sub Command3_Click()
sj.Close
Unload Me
End Sub
Private Sub Command4_Click()
If Not tmpsql.BOF Then
tmpsql.MovePrevious
Else
Command4.Enabled = False
End If
If Not tmpsql.BOF Then
Text1 = tmpsql!Name
Text2 = tmpsql!byqh
Text3 = tmpsql!hh
Text4 = tmpsql!hm
Text5 = tmpsql!ch
Text6 = tmpsql!bybm
Text7 = tmpsql!sybm
Text8 = tmpsql!bqm
Text9 = tmpsql!bzm
xbchm = tmpsql!xbch
xbblm = tmpsql!xbbl
djm = tmpsql!dj
blm = tmpsql!bl
jjdlm = tmpsql!jjdl
bshm = tmpsql!bsh
'MsgBox xbchm
If xbchm = "" Or IsNull(xbchm) Then
Text8.Enabled = False
Text9.Enabled = False
Else
Text8.Enabled = True
Text9.Enabled = True
End If
Text6.SetFocus
Else
Command4.Enabled = False
End If
End Sub
Private Sub Form_Load()
tmp = App.Path + "\data\cjsj.mdb"
Set sj = OpenDatabase(tmp, False, False, ";pwd=sunlm")
Set tmpsql = sj.OpenRecordset("select * from bk where byqh='" + string1(14) + "'")
tmpsql.MoveLast
If tmpsql.RecordCount = 0 Then
Command1.Enabled = False
Command2.Enabled = False
Command4.Enabled = False
Else
tmpsql.MoveFirst
Text1 = tmpsql!Name
Text2 = tmpsql!byqh
Text3 = tmpsql!hh
Text4 = tmpsql!hm
Text5 = tmpsql!ch
Text6 = tmpsql!bybm
Text7 = tmpsql!sybm
Text8 = tmpsql!bqm
Text9 = tmpsql!bzm
xbchm = tmpsql!xbch
xbblm = tmpsql!xbbl
djm = tmpsql!dj
blm = tmpsql!bl
jjdlm = tmpsql!jjdl
bshm = tmpsql!bsh
'MsgBox xbchm
If xbchm = "" Or IsNull(xbchm) Then
Text8.Enabled = False
Text9.Enabled = False
Else
Text8.Enabled = True
Text9.Enabled = True
End If
End If
End Sub
Private Sub Text6_GotFocus()
If Text6 <> "" Then
Text6.SelStart = 0
Text6.SelLength = Len(Text6)
End If
End Sub
Private Sub Text6_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
If Text8.Enabled Then
Text8.SetFocus
Else
Command1.SetFocus
End If
End If
End Sub
Private Sub Text8_GotFocus()
If Text8 <> "" Then
Text8.SelStart = 0
Text8.SelLength = Len(Text8)
End If
End Sub
Private Sub Text8_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
Text9.SetFocus
End If
End Sub
Private Sub Text9_GotFocus()
If Text9 <> "" Then
Text9.SelStart = 0
Text9.SelLength = Len(Text9)
End If
End Sub
Private Sub Text9_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
Command1.SetFocus
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -