📄 frmmealdata.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmMealData
BorderStyle = 1 'Fixed Single
Caption = "Update Foods"
ClientHeight = 4110
ClientLeft = 45
ClientTop = 435
ClientWidth = 8175
Icon = "frmMealData.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4110
ScaleWidth = 8175
StartUpPosition = 2 'CenterScreen
Begin VB.ComboBox Combo1
BackColor = &H00FFC0C0&
BeginProperty Font
Name = "Century Gothic"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
ItemData = "frmMealData.frx":0BC2
Left = 3000
List = "frmMealData.frx":0BCC
TabIndex = 5
Top = 600
Visible = 0 'False
Width = 1815
End
Begin MSComctlLib.ImageList ImageList1
Left = 480
Top = 3480
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 32
ImageHeight = 32
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 2
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMealData.frx":0BE2
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMealData.frx":1034
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.Toolbar Toolbar1
Height = 570
Left = 2880
TabIndex = 9
Top = 3000
Width = 2490
_ExtentX = 4392
_ExtentY = 1005
ButtonWidth = 2064
ButtonHeight = 1005
Appearance = 1
Style = 1
TextAlignment = 1
ImageList = "ImageList1"
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 3
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "Cancel"
Key = "Cancel"
ImageIndex = 1
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "Update"
Key = "Update"
ImageIndex = 2
EndProperty
EndProperty
End
Begin VB.TextBox data
Alignment = 2 'Center
BackColor = &H00FFC0C0&
BeginProperty Font
Name = "Century Gothic"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1215
Index = 2
Left = 2280
MultiLine = -1 'True
TabIndex = 7
Top = 1080
Width = 5295
End
Begin VB.TextBox data
Alignment = 2 'Center
BackColor = &H00FFC0C0&
BeginProperty Font
Name = "Century Gothic"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 1
Left = 2280
Locked = -1 'True
TabIndex = 6
Top = 600
Width = 615
End
Begin VB.TextBox data
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H00C0E0FF&
BeginProperty Font
Name = "Century Gothic"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 0
Left = 4080
Locked = -1 'True
TabIndex = 0
Top = 1920
Width = 3015
End
Begin VB.TextBox data
Alignment = 2 'Center
BackColor = &H00FFC0C0&
BeginProperty Font
Name = "Century Gothic"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 3
Left = 2280
MaxLength = 8
TabIndex = 8
Top = 2400
Width = 3735
End
Begin VB.Label Label4
Caption = "Price"
BeginProperty Font
Name = "Century Gothic"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 600
TabIndex = 4
Top = 2400
Width = 1575
End
Begin VB.Label Label3
Caption = "Description"
BeginProperty Font
Name = "Century Gothic"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 600
TabIndex = 3
Top = 1080
Width = 1575
End
Begin VB.Label Label2
BackColor = &H00FFC0C0&
Caption = "Meal Type Code"
BeginProperty Font
Name = "Century Gothic"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 2400
TabIndex = 2
Top = 1920
Width = 1575
End
Begin VB.Label Label1x
Caption = "Meal Type"
BeginProperty Font
Name = "Century Gothic"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 600
TabIndex = 1
Top = 600
Width = 1575
End
Begin VB.Shape Shape1
BackColor = &H8000000F&
BackStyle = 1 'Opaque
BorderColor = &H00FF8080&
BorderWidth = 10
Height = 3615
Left = 240
Top = 240
Width = 7695
End
Begin VB.Menu mnuMenu
Caption = "&Meal Type"
Visible = 0 'False
Begin VB.Menu mnuBuffet
Caption = "Buffet"
End
Begin VB.Menu mnuPlatein
Caption = "Plate-in"
End
End
End
Attribute VB_Name = "frmMealData"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public key As String
Public d As Integer
Private Sub data_KeyPress(Index As Integer, KeyAscii As Integer)
If KeyAscii = 13 Then SendKeys ("{TAB}")
End Sub
Private Sub data_GotFocus(Index As Integer)
If Index = 4 Then
data(1).SetFocus
frmSupp.ano = "edit"
Load frmSupp
frmSupp.Show 1
ElseIf Index = 1 Then
Combo1.Visible = True
End If
End Sub
Private Sub Combo1_Click()
check_RS
rs.Open "select * from meal_type order by mealtype_no asc", Cnn
While Not rs.EOF
If Combo1.Text = rs!Description Then
data(1).Text = rs!mealtype_no
rs.MoveLast
rs.MoveNext
Else
rs.MoveNext
End If
Wend
Combo1.Visible = False
End Sub
Private Sub Form_Load()
Combo1.Clear
check_RS1
rs1.Open "select * from meal_type order by mealtype_no asc", Cnn
While Not rs1.EOF
Combo1.AddItem (rs1(1))
rs1.MoveNext
Wend
data(1).Text = ""
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.key
'=======
Case "Cancel"
Unload Me
'=======
Case "Update"
'On Error GoTo r
Dim m As Integer
m = 0
If data(1) = "" Then
MsgBox "Please enter meal type...", vbInformation, "HMS"
data(1).SetFocus
Exit Sub
ElseIf data(2) = "" Then
MsgBox "Please enter meal description...", vbInformation, "HMS"
data(2).SetFocus
Exit Sub
ElseIf data(3) = "" Then
MsgBox "Please enter meal price...", vbInformation, "HMS"
data(3).SetFocus
Exit Sub
End If
If data(3) <> "" Then
If Not IsNumeric(data(3).Text) Then
MsgBox "The meal price you entered is invalid...", vbInformation, "HMS"
data(3).SetFocus
Exit Sub
End If
End If
'================
If frmMeal.maroi = "add" Then
check_RStemp
rstemp.Open "select * from meal", Cnn
'================
While rstemp.RecordCount > 0
check_RStemp
m = m + 1
rstemp.Open "select * from meal where meal_no = " & m, Cnn
Wend
'================
Cnn.Execute "insert into meal values(" & m & ", '" & data(1) & "', '" & _
data(2) & "', '" & data(3) & "')"
'================
ElseIf frmMeal.maroi = "edit" Then
Cnn.Execute "update meal set mealtype_no = '" & data(1) & "', description = '" & data(2) & _
"', price = '" & data(3) & "' where meal_no = " & data(0)
End If
rs.Requery 1
frmMeal.fill
Unload Me
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -