📄 modify.frm
字号:
VERSION 5.00
Begin VB.Form Form5
Caption = "修改订单"
ClientHeight = 6900
ClientLeft = 60
ClientTop = 345
ClientWidth = 10035
LinkTopic = "Form1"
ScaleHeight = 6900
ScaleWidth = 10035
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox status
Height = 270
Left = 1080
TabIndex = 31
Top = 4440
Width = 2055
End
Begin VB.TextBox pay
Height = 270
Left = 1080
TabIndex = 30
Top = 3240
Width = 2055
End
Begin VB.TextBox transport
Height = 270
Left = 1080
TabIndex = 29
Top = 2640
Width = 2055
End
Begin VB.TextBox destination
Height = 270
Left = 3840
TabIndex = 28
Top = 1440
Width = 1935
End
Begin VB.TextBox customername
Height = 270
Left = 3840
TabIndex = 27
Top = 840
Width = 1935
End
Begin VB.Data data1
Caption = "Data1"
Connect = "Access"
DatabaseName = "F:\作业\作业\database2.mdb"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 495
Left = 1200
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = ""
Top = 5640
Visible = 0 'False
Width = 3855
End
Begin VB.TextBox Text12
Height = 495
Left = -120
TabIndex = 25
Top = 6240
Width = 9735
End
Begin VB.TextBox finishdate
Height = 270
Left = 4680
TabIndex = 20
Top = 3840
Width = 1935
End
Begin VB.TextBox orderdate
Height = 270
Left = 1080
TabIndex = 18
Top = 3840
Width = 2055
End
Begin VB.TextBox total
Height = 270
Left = 6840
TabIndex = 16
Top = 2040
Width = 1455
End
Begin VB.TextBox number
Height = 270
Left = 3840
TabIndex = 14
Top = 2040
Width = 1935
End
Begin VB.TextBox price
Height = 270
Left = 1080
TabIndex = 12
Top = 2040
Width = 1335
End
Begin VB.TextBox operatorname
Height = 270
Left = 1080
TabIndex = 9
Top = 1440
Width = 1335
End
Begin VB.CommandButton Command3
Caption = "退 出"
Height = 495
Left = 8400
TabIndex = 7
Top = 240
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "修改订单"
Height = 495
Left = 6840
TabIndex = 6
Top = 240
Width = 1215
End
Begin VB.TextBox producttype
Height = 270
Left = 1080
TabIndex = 5
Top = 840
Width = 1335
End
Begin VB.TextBox productname
Height = 270
Left = 3840
TabIndex = 3
Top = 240
Width = 1935
End
Begin VB.TextBox orderid
Height = 270
Left = 1080
TabIndex = 1
Top = 240
Width = 1335
End
Begin VB.Label Label5
BackColor = &H80000018&
Caption = "(请在""未处理"",""已出货"",""已付款"",""已完成""中选择)"
ForeColor = &H8000000D&
Height = 255
Left = 3360
TabIndex = 32
Top = 4440
Width = 4335
End
Begin VB.Line Line1
X1 = 0
X2 = 11880
Y1 = 5040
Y2 = 5040
End
Begin VB.Label Label18
Caption = "客户名称"
Height = 255
Left = 2880
TabIndex = 26
Top = 840
Width = 855
End
Begin VB.Label Label17
Caption = "备注"
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 120
TabIndex = 24
Top = 5400
Width = 1215
End
Begin VB.Label Label16
Caption = "订单状态"
Height = 375
Left = 120
TabIndex = 23
Top = 4440
Width = 1215
End
Begin VB.Label Label15
Caption = "付款方式"
Height = 255
Left = 120
TabIndex = 22
Top = 3240
Width = 975
End
Begin VB.Label Label14
Caption = "运输方式"
Height = 255
Left = 120
TabIndex = 21
Top = 2640
Width = 1335
End
Begin VB.Label Label13
Caption = "交货日期"
Height = 255
Left = 3480
TabIndex = 19
Top = 3840
Width = 1215
End
Begin VB.Label Label12
Caption = "订单日期"
Height = 255
Left = 120
TabIndex = 17
Top = 3840
Width = 855
End
Begin VB.Label Label11
Caption = "总额"
Height = 255
Left = 6120
TabIndex = 15
Top = 2040
Width = 855
End
Begin VB.Label Label10
Caption = "数量"
Height = 255
Left = 2880
TabIndex = 13
Top = 2040
Width = 855
End
Begin VB.Label Label9
Caption = "单价"
Height = 255
Left = 120
TabIndex = 11
Top = 2040
Width = 975
End
Begin VB.Label Label8
Caption = "目的地"
Height = 255
Left = 2880
TabIndex = 10
Top = 1440
Width = 1095
End
Begin VB.Label Label4
Caption = "业务员"
Height = 255
Left = 120
TabIndex = 8
Top = 1440
Width = 855
End
Begin VB.Label Label3
Caption = "产品型号"
Height = 255
Left = 120
TabIndex = 4
Top = 840
Width = 735
End
Begin VB.Label Label2
Caption = "产品名称"
Height = 255
Left = 2880
TabIndex = 2
Top = 240
Width = 735
End
Begin VB.Label Label1
Caption = "订单编号"
Height = 255
Left = 120
TabIndex = 0
Top = 240
Width = 975
End
End
Attribute VB_Name = "Form5"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim db As Database
Dim rs As Recordset
Private Sub Command1_Click()
Dim sql As String
'Set db = OpenDatabase(App.Path + "/database2.mdb")
'Set rs = db.OpenRecordset("sub")
'data1.RecordSource = "update sub set producttype='" + Trim(producttype.Text) + _
"',customername='" + Trim(customername.Text) + "',operatorname='" + Trim(operatorname.Text) + _
"',destination='" + Trim(destination.Text) + "',price=" + Trim(price.Text) + ",number=" + Trim(number.Text) + _
",total=" + Trim(total.Text) + ",transport='" + Trim(transport.Text) + "',pay='" + Trim(pay.Text) + _
"',orderdate=" + Trim(orderdate.Text) + ",finishdate=" + Trim(finishdate.Text) + ",status='" + Trim(status.Text) + _
"' where productname='" + Trim(productname.Text) + "' and orderid=" + Trim(orderid.Text) + ""
'sql = "update sub set producttype='" + Trim(producttype.Text) + _
"',customername='" + Trim(customername.Text) + "',operatorname='" + Trim(operatorname.Text) + _
"',destination='" + Trim(destination.Text) + "',price=" + Trim(price.Text) + ",number=" + Trim(number.Text) + _
",total=" + Trim(total.Text) + ",transport='" + Trim(transport.Text) + "',pay='" + Trim(pay.Text) + _
"',orderdate=" + Trim(orderdate.Text) + ",finishdate=" + Trim(finishdate.Text) + ",status='" + Trim(status.Text) + _
"' where productname='" + Trim(productname.Text) + "' and orderid=" + Trim(orderid.Text) + ""
'data1.UpdateRecord
'data1.Execute sql
'data1.Refresh
'sql = "update sub set producttype='" & producttype & _
"',customername='" & customername & "',operatorname='" & operatorname & _
"',destination='" & destination & "',price='" & price & "',number='" & number & _
"',total='" & total & "',transport='" & transport & "',pay='" & pay & _
"',orderdate='" & orderdate & "',finishdate='" & finishdate & "',status='" & status & _
"' where productname='" & productname & "' and orderid='" & orderid & "'"
'db.Execute sql
data1.Recordset.Edit
If producttype.Text <> "" Then data1.Recordset.Fields("producttype") = producttype.Text
If customername.Text <> "" Then data1.Recordset.Fields("customername") = customername.Text
If operatorname.Text <> "" Then data1.Recordset.Fields("operatorname") = operatorname.Text
If destination.Text <> "" Then data1.Recordset.Fields("destination") = destination.Text
If price.Text <> "" Then data1.Recordset.Fields("price") = price.Text
If number.Text <> "" Then data1.Recordset.Fields("number") = number.Text
If total.Text <> "" Then data1.Recordset.Fields("total") = total.Text
If transport.Text <> "" Then data1.Recordset.Fields("transport") = transport.Text
If pay.Text <> "" Then data1.Recordset.Fields("pay") = pay.Text
If orderdate.Text <> "" Then data1.Recordset.Fields("orderdate") = orderdate.Text
If finishdate.Text <> "" Then data1.Recordset.Fields("finishdate") = finishdate.Text
If status.Text <> "" Then data1.Recordset.Fields("status") = status.Text
data1.Recordset.Update
data1.Refresh
Unload Me
Load Form1
'MsgBox (newName & " Was Added To The DataBase ")
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Form_Load()
Set db = OpenDatabase(App.Path + "/database2.mdb")
Set rs = db.OpenRecordset("sub")
'Dim td As TableDef
productname = productname1
orderid = orderid1
producttype = producttype1
customername = customername1
operatorname = operatorname1
destination = destination1
price = price1
number = number1
total = total1
transport = transport1
pay = pay1
orderdate = orderdate1
finishdate = finishdate1
status = status1
'For Each td In db.TableDefs
'If Left$(td.Name, 4) <> "MSys" Then _
List1.AddItem td.Name
'Next td
'db.Close
dbname = App.Path
If Right$(dbname, 1) <> "\" Then dbname = dbname & "\"
dbname = dbname & "database2.mdb"
' Attach the Data control to the database.
data1.DatabaseName = dbname 'App.Path&"database2.mdb"
'Set db = OpenDatabase("f:/test/db1.mdb") '()内是你的数据库所在位置
'Set rs = db.OpenRecordset("表1") '()内是你数据库里面的表名
data1.RecordSource = "select * from sub where orderid = " & orderid.Text & " and productname = '" & productname.Text & "' order by orderid"
data1.Refresh
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -