473,326 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Scheduling Db - Prevent Double Booking

2
I'm a self taught beginner and, with a lot of luck, I've managed to build a db to schedule classes, rooms, and students. But I'm stuck on ensuring students aren't double booked. I assigned a code to all my available time slots, so I can't double book the room, and I have a sub form on my Classes form so that I can see the Instructors schedule. I also have it that a student can't be scheduled for the same class twice. But my mushy brain can't figure out how to get an error message if the student is already scheduled for a session at 8 on Monday. I have to go to the form with the student's schedule. Help - I'm melting!
Feb 24 '07 #1
5 5229
Rabbit
12,516 Expert Mod 8TB
What about:
Expand|Select|Wrap|Line Numbers
  1. If DCount("*", "[Table Name]", "[Day Field Name] = " & Me.[Day Control Name] & " [Time Field Name] = " & Me.[Time Control Name]) > 0 Then
  2.   MsgBox "Double Booked"
  3. End If
Feb 24 '07 #2
ugcs93
2
Are these real english words or did you just make them up!

I can vaguely follow the code, I'm just not sure where to "put" it. I use wizrds and such and I've been lucky on joins and realtionships, and I do understand the basics - but que?

Thanks for the quick response though:)

What about:
Expand|Select|Wrap|Line Numbers
  1. If DCount("*", "[Table Name]", "[Day Field Name] = " & Me.[Day Control Name] & " [Time Field Name] = " & Me.[Time Control Name]) > 0 Then
  2.   MsgBox "Double Booked"
  3. End If
Feb 24 '07 #3
MMcCarthy
14,534 Expert Mod 8TB
easiest way to do it is to add a command button to the form and put this code in it.

Mary
Feb 24 '07 #4
Rabbit
12,516 Expert Mod 8TB
You can make a command button called Save, and while it doesn't actually save the record (as that's done automatically if the form is linked to the table) it can run the code. You would probably also want to add Me.Undo after the MsgBox.

Basically if DCount("*", "[Table Name]", "Search Criteria") is larger than 0 then it's double booked. It counts how many records there are where Day and Time are equal to the new record they're creating.
Feb 24 '07 #5
NeoPa
32,556 Expert Mod 16PB
Can you post the MetaData for your tables that are involved in this.
The SQL code used will depend on how you store your dates & times.
A re-usable example of MetaData is included for your use.
Expand|Select|Wrap|Line Numbers
  1. Table Name=tblStudent
  2. Field; Type; IndexInfo
  3. StudentID; Autonumber; PK
  4. Family; String; FK
  5. Name; String
  6. University; String; FK
  7. Mark; Numeric
  8. LastAttendance; Date/Time
Feb 26 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Grant | last post by:
Hi I have a database which logs the usage of rooms. Some booking are entered well in advance, and some have stays of more than six months. I would like to ensure that rooms which have been...
2
by: Andy | last post by:
Hi folks I teach. At school, four IT rooms are booked using a paper based outline timetable. Completing it is easy but basic and impossible to ensure completion of all fields (name, year...
4
by: Dinsdale | last post by:
I'm looking at adding scheduling features to an application and I wanted to ask the community about any experience with scheduling components, either open source like from code project or from a...
4
by: markymark34 | last post by:
Im messing around trying to learn Access and have hit a problem. I have a table called tblbookings and i want to seach though it when trying to make a new booking to make sure the room isnt alrady...
2
Ritchie
by: Ritchie | last post by:
Please can anyone help me with d programs in C for CPU scheduling: WAP to show FCFS scheduling algorithm. WAP to show SJF scheduling algorithm. WAP to show Priority scheduling algorithm. WAP...
3
by: Keyboyx | last post by:
I am creating a Dentist Booking form, for my A level project. I have the following Tables: Appointments Appointment ID Dentist ID Patient ID Appointment Date Appointment Time
1
by: amundsen | last post by:
I need to build a scheduling program. It will need to schedule a chain of resources. I'm wondering if anyone is aware of an existing framework that might help me to code this application. The...
3
by: Wayne | last post by:
I'm building a bookings database for trucks that among other things captures the TruckName, LoadDate, LoadTime, UnloadDate and UnloadTime. Is there a simple way to prevent double bookings for any...
12
by: Geoff Berrow | last post by:
Hi folks, I play bass in a band. and we were talking last night about how useful it would be to have a facility for all band members to enter their availability (or perhaps unavailability) so...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.