I'm a beginner with databases and I'm trying to design a database in Microsoft Access that will allow users to make bookings for fitness classes. There are two slots per day that these classes can be booked for and each session can cater for 10 people.
What I am struggling to understand is how I can limit the number of bookings made per session, per day, to ensure nobody can book a class on a session and a day that is already full up. Can anyone offer me any suggestions about how I can achieve this? I have started designing the tables but I know they aren't correct it all feels a bit of a mess.
The tables I have so far:

Customers
Customer ID (PK)
Surname
Forename
Address
Telephone No

Bookings
Booking ID (PK)
Date_taken
Customer ID (FK)

Class
Class ID (PK)
Description
Price

Session
Session ID (PK)
Session
Number per session

Booking_Class_Lines
Booking_ID(PK)
Session_ID (PK)
Class_ID (PK)
Date_of_booking

Thanks in advance

Member Avatar for diafol

Not sure I'm with you. Is the class a pre-organised one that is set to a session, or are the classes set to a session on an ad hoc basis?

It seems to me that most leisure centres etc, tend to block book classes for a time/day (recurring) for a certain period, e.g. for 8 weeks (or in perpetuity). Members can either sign up to a class and pay for the whole blocked period, or do a pay as you go (if there's room).

Can more than one class be held at the same time, e.g. 6 in one, 4 in the other or are they fixed so that only one class can be held in any particular session?

Ok well to simplify my question completely let's say I had a session and the maximum amount of people that book the session was 10. How would I limit the number of bookings that can be made for it to 10 per day?

Member Avatar for diafol

Pseudocode:
Using a conditional construct:

IF
    count of records for that session < 10
THEN
    insert record into the table
ELSE
    report session full
END IF

What is the relationship between customers and numbers of booking on your Access database?

A customer can make many bookings

Can you show all the relationships? It is hard to understand from words

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.