📄 insertfrm.frm
字号:
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Index = 3
Left = 4800
TabIndex = 12
Top = 840
Width = 960
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "联系电话"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Index = 5
Left = 4800
TabIndex = 11
Top = 1440
Width = 960
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "备 注"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Index = 6
Left = 480
TabIndex = 10
Top = 2160
Width = 960
End
Begin VB.Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "累计欠费"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 4800
TabIndex = 9
Top = 360
Width = 960
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "水费单价"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Index = 7
Left = 480
TabIndex = 8
Top = 1560
Width = 960
End
End
End
Attribute VB_Name = "frmInsert"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdAsure_Click()
Dim cnn As New ADODB.Connection
Dim reD As Double
Dim sqlAdd As String
Dim reStr As String
Dim rstR As New ADODB.Recordset
cnn.ConnectionString = cnn
cnn.CursorLocation = adUseClient
cnn.Open
reStr = dataCheck
If reStr <> "OK" Then
MsgBox reStr, vbInformation
Exit Sub
End If
rstR.Open "select * from v_水电费记录 where 姓名='" & Trim(txtUserName(1).Text) & "'", cnn, adOpenStatic, adLockBatchOptimistic
If rstR.RecordCount <> 0 Then
txtUserName(1).Text = txtUserName(1).Text & " "
End If
reD = gGetMaxKey("panelid")
sqlAdd = "insert into v_用户视图(姓名id,姓名,LEndPCode,CopyDate,lightscale,lsfee,lmoney,bmoney,cname,memotext,inia,Atimes,AtypeID) values ('" & txtUserName(0) & "','" & txtUserName(1) & "'," & Val(txtUserName(2)) & ",# " & dtpWdate.Value & "# ," & Val(txtUserName(3)) & "," & Val(txtUserName(4)) & "," & Val(txtUserName(5)) & "," & Val(txtUserName(6)) & ",'" & txtUserName(7) & "','" & txtUserName(8) & "'," & Val(txtUserName(2)) & "," & Val(Text1) & "," & Val(dcob用途.BoundText) & ")"
cnn.Execute sqlAdd
cnn.Close
MsgBox " 数据添加完成! ", vbInformation
disMax
txtUserName(3).Text = 100
For i = 1 To 8
If i <> 5 And i <> 6 And i <> 3 And i <> 7 Then
txtUserName(i) = ""
End If
Next
End Sub
Public Function dataCheck() As String
If Trim(txtUserName(1)) = "" Then
dataCheck = " 对不起,用户名称不允许为空! "
Exit Function
End If
dataCheck = "OK"
End Function
Private Sub Command1_Click()
Unload Me
End Sub
Private Sub dcob用途_Click(Area As Integer)
On Error GoTo l
If dcob用途.BoundText <> "" Then
Dim rst As New ADODB.Recordset
rst.Open "select * from 用户类型 where ATypeID=" & dcob用途.BoundText & "", gCnn, adOpenStatic, adLockBatchOptimistic
Me.txtUserName(5) = Format(rst.Fields(2), "###0.00")
rst.Close
Else
MsgBox " 请先添加用户电表类型信息! ", vbInformation
Exit Sub
End If
Exit Sub
l: MsgBox Err.Description
End Sub
Private Sub Form_Load()
txtUserName(3).Text = 100
txtUserName(7).Text = Guser
dtpWdate.Value = Format(Now, "yyyy-MM-dd")
Dim rstJB As New ADODB.Recordset
Set rstJB.ActiveConnection = gCnn
rstJB.CursorLocation = adUseClient
rstJB.LockType = adLockBatchOptimistic
rstJB.CursorType = adOpenKeyset
rstJB.Open "select * from 用户类型"
Set dcob用途.DataSource = rstJB
Set dcob用途.RowSource = rstJB
dcob用途.BoundColumn = "ATYPEID"
dcob用途.ListField = "ATYPE"
If rstJB.RecordCount <> 0 Then
dcob用途.Text = rstJB.Fields(1) & ""
Me.txtUserName(5) = Format(rstJB.Fields(2), "###0.00")
End If
disMax
End Sub
Private Sub disMax()
Dim rst As New ADODB.Recordset
rst.Open " select * from maxid where tablename ='panelid'", gCnn, adOpenStatic, adLockBatchOptimistic
If Not rst.EOF Then
txtUserName(0) = rst.Fields!maxid + 1 ' gGetMaxKey("panelid")
txtUserName(0) = PadCharL(txtUserName(0), 4, "0")
Else
txtUserName(0) = "0001"
End If
rst.Close
End Sub
Private Sub Form_Unload(Cancel As Integer)
MDIme.loadAdd
End Sub
Private Sub txtUserName_KeyPress(Index As Integer, KeyAscii As Integer)
If KeyAscii = 13 Then
If Index <= 7 Then
If Index <> 2 Then
If Index <> 4 Then
txtUserName(Index + 1).SetFocus
Else
txtUserName(Index + 3).SetFocus
End If
Else
txtUserName(Index + 2).SetFocus
End If
Else
cmdAsure.SetFocus
End If
End If
If Index <> 1 And Index <> 7 And Index <> 8 Then
If KeyAscii <> 8 And KeyAscii <> 46 And KeyAscii < 48 Or KeyAscii > 57 Then KeyAscii = 0
End If
End Sub
Public Sub init用途选择(xDataCob As DataCombo)
'为用途选择下拉框准备数据
Dim rst As New ADODB.Recordset
Call initAdo(rst)
rst.Open "select * from 用户类型 "
Set xDataCob.DataSource = rst
Set xDataCob.RowSource = rst
xDataCob.ListField = "ATYPE"
xDataCob.BoundColumn = "ATYPEID"
Set rst.ActiveConnection = Nothing
End Sub
Private Sub UpDown1_Change()
Me.Text1 = UpDown1.Value
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -