📄 frmbasictransportinfo.frm
字号:
VERSION 5.00
Object = "{4932CEF1-2CAA-11D2-A165-0060081C43D9}#2.0#0"; "Actbar2.OCX"
Begin VB.Form frmBasicTransportInfo
Caption = "运输公司明细"
ClientHeight = 6405
ClientLeft = 60
ClientTop = 345
ClientWidth = 6570
LinkTopic = "Form1"
ScaleHeight = 6405
ScaleWidth = 6570
StartUpPosition = 3 'Windows Default
Begin ActiveBar2LibraryCtl.ActiveBar2 ActiveBar21
Height = 6405
Left = 0
TabIndex = 0
Top = 0
Width = 6570
_LayoutVersion = 1
_ExtentX = 11589
_ExtentY = 11298
_DataPath = ""
Bands = "frmBasicTransportInfo.frx":0000
Begin VB.Frame Frame1
Height = 5775
Left = 60
TabIndex = 1
Top = 540
Width = 6435
Begin VB.TextBox Remark
Height = 735
Left = 1620
MultiLine = -1 'True
ScrollBars = 3 'Both
TabIndex = 22
Top = 3300
Width = 4635
End
Begin VB.ComboBox ComPayment
Height = 315
Left = 1620
TabIndex = 20
Text = "Combo1"
Top = 2760
Width = 2295
End
Begin VB.TextBox txtTransportName
BackColor = &H00C0C0FF&
Height = 315
Left = 1620
MaxLength = 50
TabIndex = 11
Top = 240
Width = 4635
End
Begin VB.CommandButton cmdClose
Caption = "關閉 &C"
Height = 315
Left = 3420
TabIndex = 10
Top = 5280
Width = 735
End
Begin VB.CommandButton cmdOk
Caption = "確定 &A"
Height = 315
Left = 1800
TabIndex = 9
Top = 5280
Width = 735
End
Begin VB.TextBox txtTel
BackColor = &H00FFFFFF&
Height = 315
Left = 1620
MaxLength = 50
TabIndex = 8
Top = 1200
Width = 2295
End
Begin VB.TextBox txtAddress
BackColor = &H00FFFFFF&
Height = 315
Left = 1620
MaxLength = 200
TabIndex = 7
Top = 720
Width = 4635
End
Begin VB.TextBox txtFax
Height = 315
Left = 1620
MaxLength = 50
TabIndex = 6
Top = 1680
Width = 2295
End
Begin VB.TextBox txtUpdateDate
BackColor = &H8000000F&
Enabled = 0 'False
Height = 315
Left = 1620
TabIndex = 5
Top = 4740
Width = 2295
End
Begin VB.TextBox txtLinkman
Height = 315
Left = 1620
MaxLength = 50
TabIndex = 4
Top = 2220
Width = 2295
End
Begin VB.TextBox txtUpdateOperator
Height = 315
Left = 1620
MaxLength = 20
TabIndex = 3
Top = 4200
Width = 2295
End
Begin VB.TextBox txtId
Height = 270
Left = -240
TabIndex = 2
Text = "Text1"
Top = 1680
Visible = 0 'False
Width = 255
End
Begin VB.Label Label8
Caption = "备注"
Height = 255
Left = 300
TabIndex = 21
Top = 3300
Width = 795
End
Begin VB.Label Label7
Caption = "付款方式"
Height = 255
Left = 300
TabIndex = 19
Top = 2760
Width = 855
End
Begin VB.Label Label3
Caption = "公司名稱"
Height = 255
Index = 4
Left = 300
TabIndex = 18
Top = 300
Width = 1035
End
Begin VB.Label Label11
Caption = "電話"
Height = 255
Left = 300
TabIndex = 17
Top = 1200
Width = 1035
End
Begin VB.Label Label1
Caption = "地址"
Height = 255
Left = 300
TabIndex = 16
Top = 720
Width = 855
End
Begin VB.Label Label2
Caption = "傳真"
Height = 315
Left = 300
TabIndex = 15
Top = 1680
Width = 915
End
Begin VB.Label Label4
Caption = "填写日期"
Height = 315
Left = 300
TabIndex = 14
Top = 4740
Width = 915
End
Begin VB.Label Label5
Caption = "聯繫人"
Height = 315
Left = 300
TabIndex = 13
Top = 2220
Width = 795
End
Begin VB.Label Label6
Caption = "填寫人"
Height = 315
Left = 300
TabIndex = 12
Top = 4200
Width = 915
End
End
End
End
Attribute VB_Name = "frmBasicTransportInfo"
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 ActiveBar21_ToolClick(ByVal Tool As ActiveBar2LibraryCtl.Tool)
Select Case Tool.Name
Case "cmdSave":
Save newItem
Case "cmdCancel":
Unload Me
Case "cmdDel":
DelOperatorInf
End Select
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub cmdOk_Click()
Save newItem
End Sub
Private Sub Form_Load()
Me.Move (Screen.Width - Me.Width) \ 2, (Screen.Height - Me.Height) \ 2
InitTitle
Initcbb ComPayment, "paymentTerm", "tBasicPayment"
End Sub
Private Sub InitTitle()
Label3.item(4).Caption = "公司名稱"
Label1.Caption = "地址"
Label11.Caption = "電話"
Label2.Caption = "傳真"
Label5.Caption = "聯繫人"
Label7.Caption = "付款方式"
Label8.Caption = "备注"
Label6.Caption = "填寫人"
Label4.Caption = "填寫日期"
cmdOk.Caption = "確定 &A"
cmdClose.Caption = "關閉 &C"
Me.Caption = "運輸公司信息"
End Sub
Private Sub DelOperatorInf()
Dim strSql As String
On Error GoTo errHandle
If MsgBox("确定要刪除?", vbQuestion + vbYesNo, "询问") = vbNo Then
Exit Sub
Else
strSql = "delete from tBasicTransport where id=" & txtId
objDatabase.ExecCmd strSql
MsgBox "刪除成功!", vbInformation, "提示"
End If
FrmBasicTransport.FillMshf1 ("select * from tBasicTransport")
Unload Me
Exit Sub
errHandle:
objDatabase.DatabaseError
End Sub
Public Sub InitInfo(strId As String)
If newItem = False Then
Dim rs As ADODB.Recordset
' 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 tBasicTransport where id=" & strId
rs.Open strSql
If Not rs.EOF Then
txtTransportName = NullValue(rs.Fields!TransportName)
txtAddress = NullValue(rs.Fields!Address)
txtTel = NullValue(rs.Fields!Tel)
txtFax = NullValue(rs.Fields!Fax)
txtLinkman = NullValue(rs.Fields!Linkman)
ComPayment = NullValue(rs.Fields!Payment)
Remark = NullValue(rs.Fields!Remark)
txtUpdateOperator = NullValue(rs.Fields!UpdateOperator)
txtUpdateDate = NullValue(rs.Fields!UpdateDate)
txtId = NullValue(rs.Fields!ID)
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 txtTransportName = "" Then
MsgBox "運輸公司名稱不能為空!", vbCritical, "提示"
txtTransportName.SetFocus
Exit Sub
End If
If blModi Then
strSql = "select * from tBasicTransport where TransportName='" & txtTransportName & "'"
rs.Open strSql
If Not rs.EOF Then
MsgBox "此運輸公司已存在!", vbCritical, "提示"
txtTransportName.Text = ""
txtTransportName.SetFocus
rs.Close
Set rs = Nothing
Exit Sub
End If
If MsgBox("是否添加新的運輸公司?", vbQuestion + vbYesNo, "询问") = vbNo Then
rs.Close
Set rs = Nothing
Exit Sub
End If
rs.AddNew '新建
rs.Fields!TransportName = txtTransportName
rs.Fields!Address = txtAddress
rs.Fields!Tel = txtTel
rs.Fields!Fax = txtFax
rs.Fields!Linkman = txtLinkman
rs.Fields!Payment = ComPayment
rs.Fields!Remark = Remark
rs.Fields!UpdateOperator = Trim$(txtUpdateOperator)
rs.Fields!UpdateDate = Now
rs.Update
MsgBox "新建成功!", vbInformation, "恭喜'"
Else
strSql = "select * from tBasicTransport where id=" & txtId
rs.Open strSql
If rs.EOF Then '修改
MsgBox "没有可修改的记录!", vbExclamation, "修改"
rs.Close
Set rs = Nothing
txtTransportName.SetFocus
Exit Sub
End If
If MsgBox("是否修改记录?", vbYesNo + vbQuestion, "修改") = vbNo Then
rs.Close
Set rs = Nothing
Exit Sub
End If
rs.Fields!TransportName = txtTransportName
rs.Fields!Address = txtAddress
rs.Fields!Tel = txtTel
rs.Fields!Fax = txtFax
rs.Fields!Linkman = txtLinkman
rs.Fields!Payment = ComPayment
rs.Fields!Remark = Remark
rs.Fields!UpdateOperator = Trim$(txtUpdateOperator)
rs.Fields!UpdateDate = Now
rs.Update
MsgBox "修改成功!", vbInformation, "恭喜"
End If
rs.Close
Set rs = Nothing
FrmBasicTransport.FillMshf1 ("select * from tBasicTransport")
Unload Me
Exit Sub
errHandle:
Set rs = Nothing
objDatabase.DatabaseError
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -