📄 nutrition.frm
字号:
VERSION 5.00
Begin VB.Form frmNutrition
BorderStyle = 1 'Fixed Single
Caption = "按营养配餐"
ClientHeight = 1890
ClientLeft = 45
ClientTop = 330
ClientWidth = 5085
ControlBox = 0 'False
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1890
ScaleWidth = 5085
StartUpPosition = 2 'CenterScreen
Begin VB.CommandButton cmdCancel
Cancel = -1 'True
Caption = "取消"
Height = 375
Left = 3360
TabIndex = 8
Top = 1440
Width = 1095
End
Begin VB.CommandButton cmdOK
Caption = "确定"
Default = -1 'True
Height = 375
Left = 720
TabIndex = 0
Top = 1440
Width = 975
End
Begin VB.Frame Frame1
Caption = "请选择营养组合:"
Height = 1215
Left = 120
TabIndex = 1
Top = 120
Width = 4815
Begin VB.ComboBox cmbNutrition
Height = 300
Index = 4
ItemData = "Nutrition.frx":0000
Left = 3840
List = "Nutrition.frx":0010
Style = 2 'Dropdown List
TabIndex = 12
Top = 240
Width = 855
End
Begin VB.ComboBox cmbNutrition
Height = 300
Index = 3
ItemData = "Nutrition.frx":0026
Left = 2280
List = "Nutrition.frx":0036
Style = 2 'Dropdown List
TabIndex = 11
Top = 240
Width = 855
End
Begin VB.ComboBox cmbNutrition
Height = 300
Index = 2
ItemData = "Nutrition.frx":004C
Left = 3600
List = "Nutrition.frx":005C
Style = 2 'Dropdown List
TabIndex = 10
Top = 720
Width = 855
End
Begin VB.ComboBox cmbNutrition
Height = 300
Index = 1
ItemData = "Nutrition.frx":0072
Left = 1320
List = "Nutrition.frx":0082
Style = 2 'Dropdown List
TabIndex = 9
Top = 720
Width = 855
End
Begin VB.ComboBox cmbNutrition
Height = 300
Index = 0
ItemData = "Nutrition.frx":0098
Left = 840
List = "Nutrition.frx":00A8
Style = 2 'Dropdown List
TabIndex = 7
Top = 240
Width = 855
End
Begin VB.Label Label5
Caption = "热量:"
Height = 255
Left = 3360
TabIndex = 6
Top = 285
Width = 615
End
Begin VB.Label Label4
Caption = "脂肪:"
Height = 255
Left = 1800
TabIndex = 5
Top = 280
Width = 615
End
Begin VB.Label Label3
Caption = "蛋白质:"
Height = 255
Left = 2760
TabIndex = 4
Top = 760
Width = 855
End
Begin VB.Label Label2
Caption = "碳水化合物:"
Height = 255
Left = 120
TabIndex = 3
Top = 760
Width = 1095
End
Begin VB.Label Label1
Caption = "胆固醇:"
Height = 255
Left = 120
TabIndex = 2
Top = 280
Width = 855
End
End
End
Attribute VB_Name = "frmNutrition"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim strFind(4) As String
Private Sub cmbNutrition_Click(Index As Integer)
Select Case Index
Case 0
Select Case cmbNutrition(Index).ListIndex
Case 0
strFind(Index) = ""
Case 1
strFind(Index) = " And Nutrition0 > 250"
Case 2
strFind(Index) = " And Nutrition0 Between 100 And 250"
Case 3
strFind(Index) = " And Nutrition0 < 100"
End Select
Case 1
Select Case cmbNutrition(Index).ListIndex
Case 0
strFind(Index) = ""
Case 1
strFind(Index) = " And Nutrition1 > 160"
Case 2
strFind(Index) = " And Nutrition1 Between 80 And 160"
Case 3
strFind(Index) = " And Nutrition1 < 80"
End Select
Case 2
Select Case cmbNutrition(Index).ListIndex
Case 0
strFind(Index) = ""
Case 1
strFind(Index) = " And Nutrition2 > 300"
Case 2
strFind(Index) = " And Nutrition2 Between 100 And 300"
Case 3
strFind(Index) = " And Nutrition2 < 100"
End Select
Case 3
Select Case cmbNutrition(Index).ListIndex
Case 0
strFind(Index) = ""
Case 1
strFind(Index) = " And Nutrition3 > 250"
Case 2
strFind(Index) = " And Nutrition3 Between 80 And 250"
Case 3
strFind(Index) = " And Nutrition3 < 80"
End Select
Case 4
Select Case cmbNutrition(Index).ListIndex
Case 0
strFind(Index) = ""
Case 1
strFind(Index) = " And Nutrition4 > 1800"
Case 2
strFind(Index) = " And Nutrition4 Between 800 And 1800"
Case 3
strFind(Index) = " And Nutrition4 < 800"
End Select
End Select
End Sub
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
With frmGuest
.Rec1.Close
Set .Rec1 = Nothing
Set .Rec1 = .DB.OpenRecordset("Select Name,Price From Menu Where Other3 = 0" & strFind(0) & strFind(1) & strFind(2) & strFind(3) & strFind(4), dbOpenSnapshot)
.ShowNamePrice .Rec1, .lstShowMenu, "请选择(按您的营养要求):"
End With
Unload Me
End Sub
Private Sub Form_Load()
Dim I As Integer
For I = 0 To 4
cmbNutrition(I).ListIndex = 0
Debug.Print strFind(I) = ""
Next
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -