📄 frmcustomerorderform.frm
字号:
Begin VB.CommandButton cmdOrderformAdd
Caption = "客户订单入库[&O]"
Height = 375
Left = 0
TabIndex = 8
Top = 0
Width = 1695
End
Begin VB.CommandButton cmdOrderformUpdate
Caption = "客户订单修改[&U]"
Height = 375
Left = 0
TabIndex = 7
Top = 420
Width = 1695
End
Begin VB.CommandButton cmdOrderformQuery
Caption = "客户订单查询[&Q]"
Height = 375
Left = 0
TabIndex = 6
Top = 840
Width = 1695
End
Begin VB.CommandButton cmdOrderformPassword
Caption = "用户密码修改[&M]"
Height = 375
Left = 0
TabIndex = 5
Top = 1680
Width = 1695
End
Begin VB.CommandButton cmdExit
Caption = "退出系统[&E]"
Height = 375
Left = 0
TabIndex = 4
Top = 2100
Width = 1695
End
Begin VB.CommandButton cmdOrderformPrint
Caption = "客户订单打印[&P]"
Height = 375
Left = 0
TabIndex = 3
Top = 1260
Width = 1695
End
End
Begin MSComctlLib.StatusBar stbInfo
Align = 2 'Align Bottom
Height = 330
Left = 0
TabIndex = 1
Top = 6525
Width = 9810
_ExtentX = 17304
_ExtentY = 582
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 6
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Bevel = 0
Object.Width = 1587
MinWidth = 1587
EndProperty
BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Object.Width = 7408
MinWidth = 7408
EndProperty
BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Style = 1
Enabled = 0 'False
Object.Width = 1323
MinWidth = 1323
TextSave = "CAPS"
EndProperty
BeginProperty Panel4 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Style = 2
Object.Width = 1323
MinWidth = 1323
TextSave = "NUM"
EndProperty
BeginProperty Panel5 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Style = 6
TextSave = "2004-8-13"
EndProperty
BeginProperty Panel6 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Style = 5
Object.Width = 1323
MinWidth = 1323
TextSave = "19:14"
EndProperty
EndProperty
End
Begin VB.Line Line1
BorderColor = &H80000010&
Index = 1
X1 = 0
X2 = 656
Y1 = 7
Y2 = 7
End
Begin VB.Line Line2
BorderColor = &H80000009&
Index = 1
X1 = 0
X2 = 656
Y1 = 8
Y2 = 8
End
Begin VB.Line Line2
BorderColor = &H80000009&
Index = 0
X1 = 0
X2 = 656
Y1 = 76
Y2 = 76
End
Begin VB.Line Line1
BorderColor = &H80000010&
Index = 0
X1 = 0
X2 = 656
Y1 = 75
Y2 = 75
End
Begin VB.Label Label1
Caption = "客 户 订 单 管 理 系 统"
BeginProperty Font
Name = "宋体"
Size = 24
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 720
Left = 1200
TabIndex = 0
Top = 360
Width = 6225
End
End
Attribute VB_Name = "frmCustomerOrderform"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'客户订单入库
Private Sub cmdOrderformAdd_Click()
Frame1.Enabled = True
Frame1.Visible = True
Frame2.Enabled = False
Frame2.Visible = False
End Sub
'客户订单查询
Private Sub cmdOrderformQuery_Click()
Frame2.Enabled = True
Frame2.Visible = True
Frame1.Enabled = False
Frame1.Visible = False
End Sub
'初始化数据查询
Private Function InitializeQuery()
End Function
'
Private Function OrderformQuery()
Set pCmd.ActiveConnection = pCnn
End Function
Private Sub Form_Load()
On Error GoTo ErrorHandler
'打开数据库重新连接。
'已经配置了ODBC数据源。使用Microsoft Access数据库为数据源。
pCnn.ConnectionString = "Driver={Microsoft Access Driver (*.mdb)};" & _
"Data Source=" & psDataSource & ";"
pCnn.CursorLocation = adUseClient
pCnn.Open
Set pRs.ActiveConnection = pCnn '将Recordset对象实例绑定到一个已经打开的数据库物理连接
pRs.CursorType = adOpenStatic '设置游标类型:静态游标,其他用户对表的记录进行删除和修改不可见
pRs.LockType = adLockOptimistic '设置锁类型:开放锁
pRs.Source = "SELECT * FROM CustomerOrderform" '打开客户订单表
pRs.Open , , , , adCmdText
Exit Sub
ErrorHandler:
MsgBox "[ErrorNumber]" & Err.Number & vbCrLf & _
"[ErrorDescription ]" & Err.Description, _
vbExclamation, "连接数据库失败"
Unload Me '
End Sub
'客户订单录入
Private Sub cmdOrderformInput_Click()
On Error GoTo ErrorHandler
Dim sTempValue As String
sTempValue = vbNullString
If Not Len(Me.txtSalesSlipNo.Text) > 0 Then
sTempValue = "【销货单号】不能为空!" & vbCrLf
End If
If Not Len(Me.txtOrderformID.Text) > 0 Then
sTempValue = sTempValue & "【订单编号】不能为空!" & vbCrLf
End If
If Not Len(Me.txtOrderformDate.Text) > 0 Then
sTempValue = sTempValue & "【订单日期】不能为空!" & vbCrLf
End If
If Not Len(Me.txtDesignStyleNo.Text) > 0 Then
sTempValue = sTempValue & "【制品款号】不能为空!" & vbCrLf
End If
If Not Len(Me.txtProductQuantity.Text) > 0 Then
sTempValue = sTempValue & "【制品数量】不能为空,且必须是数字!" & vbCrLf
End If
If Not Len(Me.txtProductName.Text) > 0 Then
sTempValue = sTempValue & "【制品名称】不能为空!" & vbCrLf
End If
If Not Len(Me.txtDeliveryDate.Text) > 0 Then
sTempValue = sTempValue & "【交货日期】不能为空!" & vbCrLf
End If
If Not Len(Me.txtOrderInputDate.Text) > 0 Then
sTempValue = sTempValue & "【入库日期】不能为空!" & vbCrLf
End If
If Len(Trim$(sTempValue)) > 0 Then
MsgBox "出错原因:" & vbCrLf & _
sTempValue & vbCrLf, vbExclamation, "数据录入出错"
Exit Sub
End If
pRs.AddNew
InputOrderformToDB '录入客户订单到数据库
pRs.Update
ShowInfor "数据录入成功!"
Exit Sub
ErrorHandler:
MsgBox "[ErrorNumber]" & Err.Number & vbCrLf & _
"[ErrorDescription ]" & Err.Description, _
vbExclamation, "错误"
End Sub
'录入客户订单到数据库
Private Sub InputOrderformToDB()
'销货单号,指客户所指定的制品编号。例如,
'客户为其所需制品(例如三星手机)所指定的销货单号为:B4165。
pRs("SalesSlipNo") = Trim$(Me.txtSalesSlipNo.Text)
'客户订单编号,指客户所需制品的编号,该编号根据销货单号来确定。
'一个销货单号可能包含多个客户订单编号
'例如客户需要1000部三星手机,其所下的订单的编号为:A00210。
pRs("OrderformID") = Trim$(Me.txtOrderformID.Text)
'制品款号,指客户所需制品的款号。例如,客户所需三星手机的款号为:Samsung628。
pRs("DesignStyleNo") = Trim$(Me.txtDesignStyleNo.Text)
'制品数量,指客户所需制品的数量。例如,客户所需三星手机的数量为:1000部。
pRs("ProductQuantity") = CLng(Val((Trim$(Me.txtProductQuantity.Text))))
'制品名称,指客户所需制品的名称。例如,客户所需制品为:三星手机-Samsung628。
pRs("ProductName") = Trim$(Me.txtProductName.Text)
'订单日期,指客户定购制品的下单日期。例如,客户定购三星手机下单的日期为:2004-8-1。
pRs("OrderformDate") = CDate(Me.txtOrderformDate.Text)
'交货日期,指客户要求收到制品的日期。例如,客户要求收到三星手机的日期为:2004-8-10。
pRs("DeliveryDate") = CDate(Me.txtDeliveryDate.Text)
'入库日期,指录入客户订单的日期
pRs("OrderInputDate") = CDate(Me.txtOrderInputDate.Text)
'备注。
pRs("Content") = Trim$(Me.txtContent.Text)
End Sub
'显示信息
Private Function ShowInfor(ByVal sInfor As String) As String
Dim i As Integer
stbInfo.Panels(2).Text = sInfor
For i = 1 To 5000
DoEvents
Next
stbInfo.Panels(2).Text = ""
End Function
Private Sub txtSalesSlipNo_LostFocus()
If Not (Len(Trim$(Me.txtSalesSlipNo.Text)) > 0) Then
ShowInfor "请输入销货单号!"
End If
End Sub
Private Sub txtOrderformID_LostFocus()
If Not (Len(Trim$(Me.txtOrderformID.Text)) > 0) Then
ShowInfor "请输入订单编号!"
End If
End Sub
Private Sub txtDesignStyleNo_LostFocus()
If Not (Len(Trim$(Me.txtDesignStyleNo.Text)) > 0) Then
ShowInfor "请输入制品款号!"
End If
End Sub
Private Sub txtProductQuantity_LostFocus()
If Not (Len(Trim$(Me.txtProductQuantity.Text)) > 0) Then
ShowInfor "请输入制品数量!"
Else
If Not IsNumeric(Trim$(Me.txtProductQuantity.Text)) Then
ShowInfor "制品数量只能为数字!"
txtProductQuantity.Text = ""
txtProductQuantity.SetFocus
End If
End If
End Sub
Private Sub txtProductName_LostFocus()
If Not (Len(Trim$(Me.txtProductName.Text)) > 0) Then
ShowInfor "请输入制品名称!"
End If
End Sub
Private Sub txtOrderformDate_LostFocus()
If Not (Len(Trim$(Me.txtOrderformDate.Text)) > 0) Then
ShowInfor "请输入订单日期!"
End If
End Sub
Private Sub txtDeliveryDate_LostFocus()
If Not (Len(Trim$(Me.txtDeliveryDate.Text)) > 0) Then
ShowInfor "请输入交货日期!"
End If
End Sub
Private Sub txtOrderInputDate_LostFocus()
If Not (Len(Trim$(Me.txtOrderInputDate.Text)) > 0) Then
ShowInfor "请输入入库日期!"
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -