📄 frmwaterpriceset.frm
字号:
VERSION 5.00
Begin VB.Form frmWaterPriceSet
Caption = "水费价格设定"
ClientHeight = 4740
ClientLeft = 3615
ClientTop = 1725
ClientWidth = 6870
Icon = "frmWaterPriceSet.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4740
ScaleWidth = 6870
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox txtDirty
Height = 375
Index = 4
Left = 4151
TabIndex = 16
Top = 3360
Width = 2295
End
Begin VB.TextBox txtDirty
Height = 375
Index = 3
Left = 4151
TabIndex = 13
Top = 2640
Width = 2295
End
Begin VB.TextBox txtDirty
Height = 375
Index = 2
Left = 4151
TabIndex = 10
Top = 1980
Width = 2295
End
Begin VB.TextBox txtDirty
Height = 375
Index = 1
Left = 4151
TabIndex = 7
Top = 1290
Width = 2295
End
Begin VB.TextBox txtDirty
Height = 375
Index = 0
Left = 4151
TabIndex = 4
Top = 600
Width = 2295
End
Begin VB.CommandButton cmdCancel
Cancel = -1 'True
Caption = "取消"
Height = 375
Left = 3840
TabIndex = 18
Top = 4080
Width = 1215
End
Begin VB.CommandButton cmdOK
Caption = "确定"
Default = -1 'True
Height = 375
Left = 1808
TabIndex = 17
Top = 4080
Width = 1215
End
Begin VB.TextBox txtPrice
Height = 375
Index = 4
Left = 1751
TabIndex = 15
Top = 3360
Width = 2055
End
Begin VB.TextBox txtPrice
Height = 375
Index = 3
Left = 1751
TabIndex = 12
Top = 2670
Width = 2055
End
Begin VB.TextBox txtPrice
Height = 375
Index = 2
Left = 1751
TabIndex = 9
Top = 1980
Width = 2055
End
Begin VB.TextBox txtPrice
Height = 375
Index = 1
Left = 1751
TabIndex = 6
Top = 1290
Width = 2055
End
Begin VB.TextBox txtPrice
Height = 375
Index = 0
Left = 1751
TabIndex = 3
Top = 600
Width = 2055
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "污水处理费"
Height = 180
Left = 4848
TabIndex = 1
Top = 240
Width = 900
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "自来水价格"
Height = 180
Left = 2328
TabIndex = 0
Top = 240
Width = 900
End
Begin VB.Label Label2
Caption = "机关、团体、事业单位用水"
Height = 345
Left = 420
TabIndex = 5
Top = 1305
Width = 1155
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "工业企业"
Height = 180
Left = 420
TabIndex = 8
Top = 2070
Width = 720
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "商业企业"
Height = 180
Left = 420
TabIndex = 11
Top = 2760
Width = 720
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "特种用水"
Height = 180
Left = 420
TabIndex = 14
Top = 3450
Width = 720
End
Begin VB.Label Label1
Caption = "居民生活公共事业用水"
Height = 420
Left = 420
TabIndex = 2
Top = 570
Width = 945
End
End
Attribute VB_Name = "frmWaterPriceSet"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim db As Database, rs As Recordset
Dim strUserType(5) As String
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
'设定水费价格
Dim i As Integer
Set db = Workspaces(0).OpenDatabase(App.Path + "\水费标准库.mdb", False, False)
Set rs = db.OpenRecordset("水费标准")
If rs.BOF Then
For i = 1 To 5
rs.AddNew
rs.Fields("编号") = i
rs.Fields("用户类型") = strUserType(i)
rs.Fields("收费标准") = Val(txtPrice(i - 1))
rs.Fields("污水处理费") = Val(txtDirty(i - 1))
rs.Update
Next
Else
rs.MoveFirst
For i = 1 To 5
rs.Edit
rs.Fields("收费标准") = Val(txtPrice(i - 1))
rs.Fields("污水处理费") = Val(txtDirty(i - 1))
rs.Update
rs.MoveNext
If rs.EOF Then rs.MoveLast
Next
End If
rs.Close
db.Close
Set rs = Nothing
Set db = Nothing
MsgBox "水费价格设定成功!", vbInformation + vbOKOnly, "水费价格设定"
Unload Me
End Sub
Private Sub Form_Load()
strUserType(1) = "居民01"
strUserType(2) = "事业02"
strUserType(3) = "工业03"
strUserType(4) = "商业04"
strUserType(5) = "特种05"
'从水费标准库中调入价格
Set db = Workspaces(0).OpenDatabase(App.Path + "\水费标准库.mdb", False, False)
Set rs = db.OpenRecordset("水费标准")
Dim i As Integer
If rs.BOF Then
Exit Sub
Else
rs.MoveFirst
For i = 1 To 5
txtPrice(i - 1) = Str(rs.Fields("收费标准"))
txtDirty(i - 1) = Str(rs.Fields("污水处理费"))
rs.MoveNext
If rs.EOF Then rs.MoveLast
Next
End If
rs.Close
db.Close
Set rs = Nothing
Set db = Nothing
End Sub
Private Sub txtDirty_LostFocus(Index As Integer)
'出错检查
If Not IsNumeric(txtDirty(Index)) Or txtDirty(Index) = "" Then
Dim i As Integer
For i = 1 To 100
Beep
Next
txtDirty(Index) = ""
End If
End Sub
Private Sub txtPrice_LostFocus(Index As Integer)
'出错检查
If Not IsNumeric(txtPrice(Index)) Or txtPrice(Index) = "" Then
Dim i As Integer
For i = 1 To 100
Beep
Next
txtPrice(Index) = ""
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -