?? frmorder.frm
字號:
Left = 4320
TabIndex = 10
Top = 720
Width = 1335
End
Begin VB.Label Label5
BackColor = &H0080FF80&
Caption = "總價格"
BeginProperty Font
Name = "隸書"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 120
TabIndex = 8
Top = 3960
Width = 975
End
Begin VB.Label Label4
BackColor = &H0080FF80&
Caption = "記錄日期"
BeginProperty Font
Name = "隸書"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 120
TabIndex = 6
Top = 3120
Width = 975
End
Begin VB.Label Label3
BackColor = &H00C0FFC0&
Caption = "客戶姓名"
BeginProperty Font
Name = "隸書"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 120
TabIndex = 4
Top = 2280
Width = 975
End
Begin VB.Label Label2
BackColor = &H00FFC0C0&
Caption = "客戶號碼"
BeginProperty Font
Name = "隸書"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 120
TabIndex = 2
Top = 1560
Width = 975
End
Begin VB.Label Label1
BackColor = &H00FFFFFF&
Caption = "定單號碼"
BeginProperty Font
Name = "隸書"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 120
TabIndex = 0
Top = 720
Width = 975
End
Begin VB.Menu hide
Caption = "操作(&D)"
Begin VB.Menu add
Caption = "添加"
Shortcut = +{F1}
End
Begin VB.Menu save
Caption = "更改"
Shortcut = +{F2}
End
Begin VB.Menu delete
Caption = "刪除"
Shortcut = +{F3}
End
Begin VB.Menu exit
Caption = "退出"
Shortcut = +{F4}
End
Begin VB.Menu next
Caption = "下一個"
Shortcut = ^{F5}
End
Begin VB.Menu shyig
Caption = "上一個"
Shortcut = ^{F6}
End
End
End
Attribute VB_Name = "frmorder"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
''''''''''''''''''''''''''''''''定單窗體中''''''''''''''''''''''''''''''''
'添加
Private Sub add_Click()
Call Command5_Click
End Sub
'根據(jù)鮮花號碼查找它的價格,乘以數(shù)量。(當(dāng)選擇不同的鮮花編號時)
Private Sub cmb2_Click()
Dim price As Double
Dim str3 As String
str3 = "select * from flower where flowercode=" & cmb2.Text
Set rs2 = Nothing
rs2.Open str3, g_dbcon, adOpenDynamic, adLockOptimistic, -1
price = rs2.Fields("flowerprice").Value
Text4.Text = price * Text7.Text
End Sub
'第一個
Private Sub Command1_Click()
rs3.MoveFirst
Call showorder
End Sub
'上一個
Private Sub Command2_Click()
rs3.MovePrevious
If rs3.BOF = True Then
rs3.MoveLast
End If
Call showorder
End Sub
'下一個
Private Sub Command3_Click()
rs3.MoveNext
If rs3.EOF = True Then
rs3.MoveFirst
End If
Call showorder
End Sub
'最后一個
Private Sub Command4_Click()
rs3.MoveLast
Call showorder
End Sub
'添加
Private Sub Command5_Click()
If Text1.Text = "" Or cmb1.Text = "" Or Text2.Text = "" Or Text5.Text = "" Or cmb2.Text = "" Or Text6.Text = "" Or Text7.Text = "" Then
MsgBox "請輸入完整的數(shù)據(jù)!", vbInformation + vbOKOnly, "數(shù)據(jù)不完整"
Else
rs3.AddNew
rs3.Fields("customercode").Value = cmb1.Text
rs3.Fields("recivername").Value = Text2.Text
rs3.Fields("recorddate").Value = Text3.Text
rs3.Fields("orderdate").Value = Text5.Text
rs3.Fields("flowercode").Value = cmb2.Text
rs3.Fields("address").Value = Text6.Text
rs3.Fields("quity").Value = Text7.Text
rs3.Update
MsgBox "數(shù)據(jù)添加成功!", vbInformation, "添加"
End If
End Sub
'更改數(shù)據(jù)
Private Sub Command6_Click()
rs3.Fields("customercode").Value = cmb1.Text
rs3.Fields("recivername").Value = Text2.Text
rs3.Fields("recorddate").Value = Text3.Text
rs3.Fields("orderdate").Value = Text5.Text
rs3.Fields("flowercode").Value = cmb2.Text
rs3.Fields("address").Value = Text6.Text
rs3.Fields("quity").Value = Text7.Text
rs3.Update
MsgBox "數(shù)據(jù)修改成功!", vbInformation + vbOKOnly, "數(shù)據(jù)修改"
End Sub
'刪除
Private Sub Command7_Click()
If MsgBox("數(shù)據(jù)刪除將不能恢復(fù),您確定要刪除嗎?", vbQuestion + vbYesNo, "提示信息") = vbYes Then
rs3.delete adAffectCurrent
rs3.UpdateBatch adAffectAllChapters
rs3.MoveFirst
Call showorder
End If
MsgBox "數(shù)據(jù)刪除成功"
End Sub
'退出
Private Sub Command8_Click()
Unload Me
End Sub
Private Sub delete_Click()
Call Command7_Click
End Sub
Private Sub exit_Click()
Unload Me
End Sub
'
Private Sub Form_Load()
'顯示數(shù)據(jù)
Dim strsql3 As String
strsql3 = "select * from orders"
Set rs3 = Nothing
Call rs3.Open(strsql3, g_dbcon, adOpenDynamic, adLockOptimistic, -1)
rs3.MoveFirst
Call showorder
'把客戶表中的編號加到列表框中
Dim ccode As String
ccode = "select * from customers"
Set rs1 = Nothing
rs1.Open ccode, g_dbcon, adOpenDynamic, adLockOptimistic, -1
While rs1.EOF = False
cmb1.AddItem rs1.Fields("customercode").Value
rs1.MoveNext
Wend
cmb1.ListIndex = 0
'把鮮花表中的鮮花編號加到列表框中
Dim fcode As String
fcode = "select * from flower"
Set rs2 = Nothing
rs2.Open fcode, g_dbcon, adOpenDynamic, adLockOptimistic, -1
Do While Not rs2.EOF
cmb2.AddItem rs2.Fields("flowercode").Value
rs2.MoveNext
Loop
cmb2.ListIndex = 0
'根據(jù)鮮花的編號查找到它的價格
Dim price As Double
Dim str3 As String
str3 = "select * from flower where flowercode=" & cmb2.Text
Set rs2 = Nothing
rs2.Open str3, g_dbcon, adOpenDynamic, adLockOptimistic, -1
price = rs2.Fields("flowerprice").Value
Text4.Text = price * Text7.Text
End Sub
Private Sub next_Click()
Call Command3_Click
End Sub
Private Sub save_Click()
Call Command6_Click
End Sub
Private Sub shyig_Click()
Call Command2_Click
End Sub
'改變數(shù)量時,總價也隨之改變
Private Sub Text7_Change()
Dim price As Double
Dim str3 As String
str3 = "select * from flower where flowercode=" & cmb2.Text
Set rs2 = Nothing
rs2.Open str3, g_dbcon, adOpenDynamic, adLockOptimistic, -1
price = rs2.Fields("flowerprice").Value
Text4.Text = price * Text7.Text
End Sub
Private Sub Timer1_Timer()
Text3.Text = Date
End Sub
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -