473,471 Members | 2,122 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Using Date and Time

reginaldmerritt
201 New Member
I'm in the process of planning out a database that can organise our staff bookings. Basically having the ability to link staff to certain clients at chosen periods of time.

For example StaffMemberA may be booked to with ClientA on 01/01/09 from 08:00 to 20:00. This data could be held in the table tbBookings with Primary keys StaffMemberName and Date.

What i want the program to do is to tell the user if StaffMemberA is already booked in the time selected. This could be done by looking at tbBookings to see if StaffMemberA with Date is there. But how do i relay that StaffMember is available from 00:00 to 08:00 or 20:00 to 00:00. In other words tell what hours StaffMemberA can be booked so that a double booking does not arise.

I was planning to create a new table from any bookings made that hold the Date, StaffMemberName and a Boolean field for each time segment from 00:00 to 00:30 and so on till 24:30. So the program can look at this table to tell if a StaffMember is available on any given day. But I thought there must be an easier way to do this rather than creating a whole new table.

Any help or suggestions are welcome. Thanks
Sep 4 '07 #1
8 1781
Rabbit
12,516 Recognized Expert Moderator MVP
There's no simple way to do this with a standard query but a VBA function can return a string specifying the times available by looping through the records that are not available.
Sep 4 '07 #2
reginaldmerritt
201 New Member
There's no simple way to do this with a standard query but a VBA function can return a string specifying the times available by looping through the records that are not available.
I think realy it depends on how i can get the program to interprate the two fields with the time FROM and TO. Say FROM = 8:00 and TO = 20:00 i need to represent that as a block of time some how, perhaps with an array? ummm..

Anyway i guess i'll have to keep at if there is no simple way to do it. Thank you for your help.
Sep 5 '07 #3
Rabbit
12,516 Recognized Expert Moderator MVP
Like you said in your first post, you can make a new table with all the available times or you're looking at some VBA coding. Do you have any experience with VBA?
Sep 5 '07 #4
Rabbit
12,516 Recognized Expert Moderator MVP
Resuscribing .
Sep 5 '07 #5
reginaldmerritt
201 New Member
Done some basic stuff VB not really worked with databases before. I was going to create a form to hold the data i wanted to write to a new table. If you have some advice i would be appreciated, i'm not expecting you to have to go in to to much detail.
Sep 6 '07 #6
Rabbit
12,516 Recognized Expert Moderator MVP
Let me know if you understand this:

This is the description of a function that will return a string with the available times for a chosen person on a chosen day.

1) Create a recordset that pulls all records for one person for one day ordering by the time.

2) If the record count is larger than zero. Loop until you hit the end of the recordset.

3) Starting with 00:00, the start time of the record in the recordset is the end time of the free period. The start time of the next free period is set to the end time of the record in the recordset.

4) At end of recordset the end time of the last free period is 23:59.

Throughout, you will be concatenating into a string that will be returned by the function.
Sep 6 '07 #7
reginaldmerritt
201 New Member
thanks for getting back to me,sorry that i've taken so long to reply.

I think i understand, that defintly makes more programming sence than using an array. Not quite sure on the syntax but i can look that up, i understand what your getting at.

Thank you, i'll give it try.
Sep 12 '07 #8
Rabbit
12,516 Recognized Expert Moderator MVP
Good luck. Let us know if you run into any roadblocks.
Sep 12 '07 #9

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

Similar topics

18
by: Robin Lawrie | last post by:
Hi again, another problem! I've moved from an Access database to SQL server and am now having trouble inserting dates and times into seperate fields. I'm using ASP and the code below to get the...
1
by: rock72 | last post by:
I am developing a application using this fields as required by the company. 1. Date Login 2. Time IN 3. Time OUT My question is how to produce the number of days with 1 entry of Date is...
16
by: John Hanley | last post by:
I created a function that breaks down a date into broken down time, I subtract a certain number of seconds from that, then use mktime() to recompute the calendar time. It works basically except...
9
by: Guy | last post by:
I have extended the datetimepicker control to incorporate a ReadOnly property. I have used the new keyword to implement my own version of the value property, so that if readonly == true then it...
0
by: Brian Young | last post by:
Hi all. I'm using the Property Grid control in a control to manage a windows service we have developed here. The windows service runs a set of other jobs that need to be managed. The control...
15
by: Khurram | last post by:
I have a problem while inserting time value in the datetime Field. I want to Insert only time value in this format (08:15:39) into the SQL Date time Field. I tried to many ways, I can extract...
6
by: ransoma22 | last post by:
I developing an application that receive SMS from a connected GSM handphone, e.g Siemens M55, Nokia 6230,etc through the data cable. The application(VB.NET) will receive the SMS automatically,...
13
by: Jim Armstrong | last post by:
Hi all - This problem has been driving me crazy, and I'm hoping the answer is something stupid I am neglecting to see.... The procedure posted below is part of an Access/SQL database I have...
2
cassbiz
by: cassbiz | last post by:
I am using strtotime and I have read up on some examples and am getting the wrong output, it jumps by several days instead of one day at a time. Ultimately what I am trying to accomplish is to set...
6
by: Mark | last post by:
Currently using MS Access 2000 and SQL Server Express. Using the current DAO OpenRecordset code listed below, however I keep getting the error message.... 3254: ODBC --Cannot lock all records ...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.