⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmorder.frm

📁 鲜花订购系统(这是单机版的),采用VB+Access编写
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      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
'根据鲜花号码查找它的价格,乘以数量。(当选择不同的鲜花编号时)
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 "请输入完整的数据!", vbInformation + vbOKOnly, "数据不完整"
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 "数据添加成功!", vbInformation, "添加"
End If
End Sub
'更改数据
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 "数据修改成功!", vbInformation + vbOKOnly, "数据修改"
End Sub
'删除
Private Sub Command7_Click()
 
If MsgBox("数据删除将不能恢复,您确定要删除吗?", vbQuestion + vbYesNo, "提示信息") = vbYes Then
rs3.delete adAffectCurrent
rs3.UpdateBatch adAffectAllChapters
rs3.MoveFirst
Call showorder
End If
MsgBox "数据删除成功"
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()
'显示数据
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

'根据鲜花的编号查找到它的价格
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

'改变数量时,总价也随之改变
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

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -