📄 frmstorehousesetnew.frm
字号:
VERSION 5.00
Begin VB.Form frmBaseinfoPaymentNew
Caption = "編輯信息"
ClientHeight = 2985
ClientLeft = 60
ClientTop = 345
ClientWidth = 5985
LinkTopic = "Form1"
ScaleHeight = 2985
ScaleWidth = 5985
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox txtId
BackColor = &H80000004&
Height = 375
Left = 1440
Locked = -1 'True
TabIndex = 7
Top = 240
Width = 1455
End
Begin VB.TextBox txtPriceAddr
Height = 615
Left = 1440
MultiLine = -1 'True
TabIndex = 5
Top = 1560
Width = 4095
End
Begin VB.TextBox txtPayment
Height = 615
Left = 1440
MultiLine = -1 'True
TabIndex = 4
Top = 720
Width = 4095
End
Begin VB.CommandButton cmdClose
Caption = "關閉"
Height = 375
Left = 3480
TabIndex = 1
Top = 2400
Width = 735
End
Begin VB.CommandButton cmdOk
Caption = "確定"
Height = 375
Left = 1680
TabIndex = 0
Top = 2400
Width = 735
End
Begin VB.Label Label3
Caption = "ID"
Height = 255
Left = 480
TabIndex = 6
Top = 240
Width = 855
End
Begin VB.Label Label2
Caption = "價格地區"
Height = 255
Left = 480
TabIndex = 3
Top = 1560
Width = 735
End
Begin VB.Label Label1
Caption = "付款方式"
Height = 255
Left = 480
TabIndex = 2
Top = 720
Width = 735
End
End
Attribute VB_Name = "frmBaseinfoPaymentNew"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public newItem As Boolean 'true表示增加
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
Save newItem
End Sub
Private Sub Form_Load()
'设置窗口大小
FormInit Me, False
End Sub
'初始化
Public Sub InitInfo(strID As String)
If newItem = False Then
Dim rs As ADODB.Recordset
SystemExecuteStart Me
' On Error GoTo errLabel
Set rs = New ADODB.Recordset
With rs
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
Set .ActiveConnection = cn
End With
Dim strSql As String
strSql = "select * from infoSet where id=" & strID
rs.Open strSql
If Not rs.EOF Then
txtId.Text = rs.Fields!ID
txtPayment.Text = rs.Fields!paymentTerm
txtPriceAddr.Text = rs.Fields!priceTerm
End If
rs.Close
Set rs = Nothing
SystemExecuteEnd Me
End If
Exit Sub
errLabel:
SystemExecuteEnd Me
objDatabase.DatabaseError
End Sub
Private Sub Save(Optional blModi As Boolean)
Dim strSql As String
Dim rs As ADODB.Recordset
On Error GoTo errHandle
Set rs = New ADODB.Recordset
With rs
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
Set .ActiveConnection = cn
End With
If blModi Then
strSql = "select * from infoSet"
rs.Open strSql
If MsgBox("是否要添加信息?", vbQuestion + vbYesNo, "询问") = vbNo Then
rs.Close
Set rs = Nothing
Exit Sub
End If
rs.AddNew '新建
rs.Fields!paymentTerm = Trim$(txtPayment.Text)
rs.Fields!priceTerm = Trim$(txtPriceAddr.Text)
rs.Fields!DTime = Now
rs.Update
MsgBox "新建成功!", vbInformation, "恭喜'"
Else
strSql = "select * from infoSet where id=" & txtId
rs.Open strSql
If MsgBox("是否修改信息?", vbYesNo + vbQuestion, "修改") = vbNo Then
rs.Close
Set rs = Nothing
Exit Sub
End If
rs.Fields!paymentTerm = Trim$(txtPayment)
rs.Fields!priceTerm = Trim$(txtPriceAddr.Text)
rs.Fields!DTime = Now
rs.Update
MsgBox "修改成功!", vbInformation, "恭喜"
End If
rs.Close
Set rs = Nothing
frmBaseinfoPayment.FillMshf1 ("select * from infoSet")
Unload Me
Exit Sub
errHandle:
Set rs = Nothing
objDatabase.DatabaseError
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -