📄 frmwaterdj.frm
字号:
VERSION 5.00
Object = "{CE671F01-259E-40DA-92FE-95803E2ECBB5}#1.0#0"; "SMARTXPBUTTON.OCX"
Begin VB.Form FrmWaterDj
BackColor = &H00E0E0E0&
BorderStyle = 3 'Fixed Dialog
Caption = "修改水费单价"
ClientHeight = 2205
ClientLeft = 30
ClientTop = 315
ClientWidth = 4710
Icon = "FrmWaterDj.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2205
ScaleWidth = 4710
StartUpPosition = 2 '屏幕中心
Begin SmartXPButton.XpButton Command1
Height = 435
Index = 0
Left = 2550
TabIndex = 2
TabStop = 0 'False
Top = 1500
Width = 1335
_ExtentX = 2355
_ExtentY = 767
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "退出(&X)"
PictureSmoothBackColor= 13882323
ButtonPicture = "FrmWaterDj.frx":014A
End
Begin SmartXPButton.XpButton Command1
Default = -1 'True
Height = 435
Index = 2
Left = 750
TabIndex = 1
TabStop = 0 'False
Top = 1500
Width = 1635
_ExtentX = 2884
_ExtentY = 767
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "保存修改(&C)"
PictureSmoothBackColor= 13882323
ButtonPicture = "FrmWaterDj.frx":02A4
End
Begin VB.TextBox Text1
Alignment = 1 'Right Justify
Appearance = 0 'Flat
BackColor = &H00DFFFF8&
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 1005
ScrollBars = 2 'Vertical
TabIndex = 0
Text = "2"
ToolTipText = "户主不能为空"
Top = 825
Width = 3165
End
Begin VB.Label Label2
Alignment = 2 'Center
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Label2"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 240
Left = 75
TabIndex = 4
Top = 150
Width = 4545
End
Begin VB.Label Label1
Alignment = 1 'Right Justify
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "单价:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Index = 1
Left = 450
TabIndex = 3
Top = 885
Width = 630
End
End
Attribute VB_Name = "FrmWaterDj"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public nYear As Integer
Public nMonth As Integer
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyEscape Then Unload Me
End Sub
Private Sub Form_Load()
Me.KeyPreview = True
Text1.Text = ""
End Sub
Private Sub Text1_GotFocus()
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 39 Then KeyAscii = 0: Exit Sub
If KeyAscii <= vbKey9 And KeyAscii >= 46 Or KeyAscii = vbKeyBack Then Exit Sub
KeyAscii = 0
End Sub
Private Sub Command1_Click(Index As Integer)
Select Case Index
Case 0 '退出
Unload Me
Case 2 '修改
If Val(Text1.Text) < 0 Then
MsgBox "不能把单价修改成:0", vbOKOnly + vbCritical, "单价出错..."
Text1.SetFocus
Exit Sub
End If
If nYear = 0 Or nMonth = 0 Then
MsgBox "年份或月份不能出现:0", vbOKOnly + vbCritical, "时间出错..."
Text1.SetFocus
Exit Sub
End If
Dim Rec As New ADODB.Recordset
Me.Hide
FrmStatus1.Label1.Caption = nYear & "年" & nMonth & "月水费单价修改..."
FrmStatus1.Show
DoEvents
Cn_Rsh.Execute "update lqwater set dj=" & Val(Text1.Text) & " where year=" & _
nYear & " and month=" & nMonth
Set Rec = Cn_Rsh.Execute("select * from lqryk where id not in (select id from " & _
"lqwater where year=" & nYear & " and month=" & nMonth & ")")
If Not Rec.EOF And Not Rec.BOF Then
Do While Not Rec.EOF
Cn_Rsh.Execute "insert into lqwater([id],[ycount],[ncount],[dj],[money]," & _
"[year],[month]) values(" & _
Rec.Fields("id").Value & ",0,0," & Val(Text1.Text) & ",0," & _
nYear & "," & nMonth & ")"
Rec.MoveNext
Loop
End If
Cn_Rsh.Execute "update lqwater set [money]=[dj]*(ncount-ycount) where year=" & nYear & " and month=" & nMonth
Cn_Rsh.Execute "update lqwater set [money]=0 where [money]<0 and year=" & nYear & " and month=" & nMonth
MdlMain.ReturnSql = "单价修改成功"
Unload FrmStatus1
Unload Me
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -