Form Adding Help

jeffrey159

Registered User.
Local time
Today, 13:20
Joined
Jan 17, 2013
Messages
24
[FONT=&quot]This form must count and display the number of sold tickets for each seat category when the user selects one of the options.
[/FONT]
This is the picture of the form

Untitled_zps4f4f406b.jpg



Private Sub Form_Load()

' When the form loads, select the first item in the Category ComboBox
Me.ID_Match = Me.ID_Match.ItemData(0)

Me.Quantity.DefaultValue = 1
End Sub
Private Sub ID_Match_AfterUpdate()

' Call the code that updates the Away Clubs ListBox based on the selected Match
Me.AwayClub.RowSource = "SELECT distinct tblClubs.clubName " & _
"FROM tblClubs, " & "tblDrug_Test_Selection, " & "tblMatches " & _
"WHERE tblDrug_Test_Selection.ID_Match = " & Me.ID_Match & _
"AND tblDrug_Test_Selection.ID_Club = tblClubs.ID " & _
"AND tblDrug_Test_Selection.ID_Club = tblMatches.ID_awayClub"

' Call the code that updates the Home Clubs ListBox based on the selected Match
Me.HomeClub.RowSource = "SELECT distinct tblClubs.clubName " & _
"FROM tblClubs, " & "tblDrug_Test_Selection, " & "tblMatches " & _
"WHERE tblDrug_Test_Selection.ID_Match = " & Me.ID_Match & _
"AND tblDrug_Test_Selection.ID_Club = tblClubs.ID " & _
"AND tblDrug_Test_Selection.ID_Club = tblMatches.ID_homeClub"

' Call the code that updates the Running Date ListBox based on the selected Match
Me.RunDate.RowSource = "SELECT distinct tblDrug_Test_Selection.runningDate " & _
"FROM tblDrug_Test_Selection, " & "tblMatches " & _
"WHERE tblDrug_Test_Selection.ID_Match = " & Me.ID_Match & _
"AND tblDrug_Test_Selection.runningDate = tblMatches.matchDate"


End Sub

Private Sub Quantity_Change()
If Quantity.Value > 1 & Quantity.Value <= 10 Then
Sell.Enabled = True
Else
Sell.Enabled = False
End If

End Sub

Private Sub Sell_Click()


If Me.Quantity.Value > 10 Then
MsgBox ("Limit Exceeded")
Me.Quantity = ""
End If


If Me.cboTicketType = "Cabin" Then
txtCabin = Me.Quantity.Value

ElseIf Me.cboTicketType = "Stand" Then
txtStand = Me.Quantity.Value

ElseIf Me.cboTicketType = "Stand-Superior" Then
txtStandSup = Me.Quantity.Value
End If
End Sub
 

Users who are viewing this thread

Back
Top Bottom