My database is a flight booking system (USING Access2000):
I have a form that has 2 subforms the form displays the flight data along with 1 subform for the main passenger, address, numberoftickets (required) and total cost the other subform is for any additional passengers travelling with main passenger.
Q1
How do I get subform 2 to only allow the a specific number of entries for that passenger
i.e. Ian want 2 tickets so Ian is main and 1 additional passenger so I want subform 2 to allow only 1 entry for passenger Ian
Q2
I want the main form to update and show the ticketsavailable (minus) the numberoftickets (required) and an error message if numberoftickets (required) is more than ticketsavailable.
This is my current code which isn’t working!!!
Private Sub numbeoftickets_AfterUpdate()
If [numberoftickets] > [Forms]![Frmbookflight]![Numberofseats] Then 'I'VE GOT THIS TO WORK NOW with amended code'
MsgBox "error"
Else
totalcost = [numbeoftickets] * [Forms]![Frmbookflight]![Cost] 'This is working'
[Forms]![Frmbookflight]![Numberofseats] = [Forms]![Frmbookflight]![Numberofseats] - [numberoftickets] '**THIS IS STILL CAUSING ME PROBLEMS**'
End If
End Sub
Also any help on limiting the number of entries into a subform?
Thanks Ian
[This message has been edited by ian_ok (edited 04-22-2002).]
I have a form that has 2 subforms the form displays the flight data along with 1 subform for the main passenger, address, numberoftickets (required) and total cost the other subform is for any additional passengers travelling with main passenger.
Q1
How do I get subform 2 to only allow the a specific number of entries for that passenger
i.e. Ian want 2 tickets so Ian is main and 1 additional passenger so I want subform 2 to allow only 1 entry for passenger Ian
Q2
I want the main form to update and show the ticketsavailable (minus) the numberoftickets (required) and an error message if numberoftickets (required) is more than ticketsavailable.
This is my current code which isn’t working!!!
Private Sub numbeoftickets_AfterUpdate()
If [numberoftickets] > [Forms]![Frmbookflight]![Numberofseats] Then 'I'VE GOT THIS TO WORK NOW with amended code'
MsgBox "error"
Else
totalcost = [numbeoftickets] * [Forms]![Frmbookflight]![Cost] 'This is working'
[Forms]![Frmbookflight]![Numberofseats] = [Forms]![Frmbookflight]![Numberofseats] - [numberoftickets] '**THIS IS STILL CAUSING ME PROBLEMS**'
End If
End Sub
Also any help on limiting the number of entries into a subform?
Thanks Ian
[This message has been edited by ian_ok (edited 04-22-2002).]