Wednesday, 4 February 2009

restaurant_theodbs_assignment



Public listX As Integer

Private Sub cmdback_Click(Index As Integer)

If listX = 0 Then

MsgBox "Well, there is no more ingredient in the list!", vbOKOnly

Else

listX = listX - 1

Listing.Enabled = True

Listing.RemoveItem (listX)

End If

End Sub

Private Sub cmdGo_Click(Index As Integer)

Listing.Enabled = True

Listing.List(listX) = dataIngdts.Text

listX = listX + 1

End Sub

Private Sub combomenu_Click()

Dim data As ADODB.Recordset

Set data = New ADODB.Recordset

If DataEnvironment1.Connection1.State = adstateclose Then

DataEnvironment1.Connection1.Open

End If

If combomenu.Text = "Chicken Salad" Then

data.Open "SELECT tblmadewith.quantity,tblmadewith.unit, tblingredients.name FROM tblmadewith,tblingredients WHERE tblmadewith.itemid = 'CHKSD' and tblingredients.ingredientid = tblmadewith.ingredientid;", DataEnvironment1.Connection1, adOpenDynamic, adLockOptimistic

Set dataIngdts.DataSource = data

ElseIf combomenu.Text = "Chicken N Suds" Then

data.Open "SELECT tblmadewith.quantity,tblmadewith.unit, tblingredients.name FROM tblmadewith,tblingredients WHERE tblmadewith.itemid = 'CKSDS' and tblingredients.ingredientid = tblmadewith.ingredientid;", DataEnvironment1.Connection1, adOpenDynamic, adLockOptimistic

Set dataIngdts.DataSource = data

ElseIf combomenu.Text = "Fruit Plate" Then

data.Open "SELECT tblmadewith.quantity,tblmadewith.unit, tblingredients.name FROM tblmadewith,tblingredients WHERE tblmadewith.itemid = 'FRPLT' and tblingredients.ingredientid = tblmadewith.ingredientid;", DataEnvironment1.Connection1, adOpenDynamic, adLockOptimistic

Set dataIngdts.DataSource = data

ElseIf combomenu.Text = "Fruit Salad" Then

data.Open "SELECT tblmadewith.quantity,tblmadewith.unit, tblingredients.name FROM tblmadewith,tblingredients WHERE tblmadewith.itemid = 'FRTSD' and tblingredients.ingredientid = tblmadewith.ingredientid;", DataEnvironment1.Connection1, adOpenDynamic, adLockOptimistic

Set dataIngdts.DataSource = data

ElseIf combomenu.Text = "Garden Salad" Then

data.Open "SELECT tblmadewith.quantity,tblmadewith.unit, tblingredients.name FROM tblmadewith,tblingredients WHERE tblmadewith.itemid = 'GDNSD' and tblingredients.ingredientid = tblmadewith.ingredientid;", DataEnvironment1.Connection1, adOpenDynamic, adLockOptimistic

Set dataIngdts.DataSource = data

ElseIf combomenu.Text = "Millenium Salad" Then

data.Open "SELECT tblmadewith.quantity,tblmadewith.unit, tblingredients.name FROM tblmadewith,tblingredients WHERE tblmadewith.itemid = 'MILSD' and tblingredients.ingredientid = tblmadewith.ingredientid;", DataEnvironment1.Connection1, adOpenDynamic, adLockOptimistic

Set dataIngdts.DataSource = data

ElseIf combomenu.Text = "Soda" Then

data.Open "SELECT tblmadewith.quantity,tblmadewith.unit, tblingredients.name FROM tblmadewith,tblingredients WHERE tblmadewith.itemid = 'SODA' and tblingredients.ingredientid = tblmadewith.ingredientid;", DataEnvironment1.Connection1, adOpenDynamic, adLockOptimistic

Set dataIngdts.DataSource = data

ElseIf combomenu.Text = "Vegan Eatin'" Then

data.Open "SELECT tblmadewith.quantity,tblmadewith.unit, tblingredients.name FROM tblmadewith,tblingredients WHERE tblmadewith.itemid = 'VGNET' and tblingredients.ingredientid = tblmadewith.ingredientid;", DataEnvironment1.Connection1, adOpenDynamic, adLockOptimistic

Set dataIngdts.DataSource = data

ElseIf combomenu.Text = "Water" Then

data.Open "SELECT tblmadewith.quantity,tblmadewith.unit, tblingredients.name FROM tblmadewith,tblingredients WHERE tblmadewith.itemid = 'WATER' and tblingredients.ingredientid = tblmadewith.ingredientid;", DataEnvironment1.Connection1, adOpenDynamic, adLockOptimistic

Set dataIngdts.DataSource = data

End If

End Sub