Hi,
I have an equipment booking form that a user is able to book a piece of equipment on a selected date and time. I have written code to prevent the user being able to book the piece of equipment if it has already been booked by a different user on the same date/time.
I want to display in a time grid format when that piece of equipment is booked. I currently have 16 green coloured boxes on my form each representing an hour's time interval so box 1 is 09:00 - 10:00 and so on. If the selected piece of equipment is booked on that day for a given time interval for example 12:00 - 15:00 I want to change the colour of the box's that represent 12:00 - 13:00 13:00 - 14:00 and 14:00 to 15:00 to red (which represents the equipment is already booked)
I currently have code that gives me a start and end time for the booking which enables me to change the start and end time box's to red as follows.Just cant think of a way to change the boxes in between - If BkdStartTimeID = #12:00:00 PM# Then
-
-
[Forms]![F_EquipBooking].[SF_EquipBooking]![Box12].BackColor = lngRed
-
-
If BkdEndTimeID = #3:00:00 PM# Then
-
-
[Forms]![F_EquipBooking].[SF_EquipBooking]![Box15].BackColor = lngRed
I hope my ramblings make sense any help is much appreciated
Regards Phill
7 2035
Hi,
I have an equipment booking form that a user is able to book a piece of equipment on a selected date and time. I have written code to prevent the user being able to book the piece of equipment if it has already been booked by a different user on the same date/time.
I want to display in a time grid format when that piece of equipment is booked. I currently have 16 green coloured boxes on my form each representing an hour's time interval so box 1 is 09:00 - 10:00 and so on. If the selected piece of equipment is booked on that day for a given time interval for example 12:00 - 15:00 I want to change the colour of the box's that represent 12:00 - 13:00 13:00 - 14:00 and 14:00 to 15:00 to red (which represents the equipment is already booked)
I currently have code that gives me a start and end time for the booking which enables me to change the start and end time box's to red as follows.Just cant think of a way to change the boxes in between - If BkdStartTimeID = #12:00:00 PM# Then
-
-
[Forms]![F_EquipBooking].[SF_EquipBooking]![Box12].BackColor = lngRed
-
-
If BkdEndTimeID = #3:00:00 PM# Then
-
-
[Forms]![F_EquipBooking].[SF_EquipBooking]![Box15].BackColor = lngRed
I hope my ramblings make sense any help is much appreciated
Regards Phill
Good thing to try to make the time visible in this way.
I would use the Box name to manipulate the boxes in a loop.
You already use 12, 13, 14, 15, etc as the box name so a loop like: -
intStart = format(BkdStartTimeID,"hh")
-
intEnd = format(BkdEndTimeID ,"hh")
-
WHILE intStart <= intEnd
-
Me.fields("Box" & format(intStart,"00").Backcolor = vbRed
-
intStart = intStart + 1
-
WEND
-
Just make sure all boxes are there and that the BkdEndTimeID has a value.
Getting the idea ?
Nic;o)
Good thing to try to make the time visible in this way.
I would use the Box name to manipulate the boxes in a loop.
You already use 12, 13, 14, 15, etc as the box name so a loop like: - intStart = format(BkdStartTimeID,"hh")
-
intEnd = format(BkdEndTimeID ,"hh")
-
WHILE intStart <= intEnd
-
Me.fields("Box" & format(intStart,"00").Backcolor = vbRed
-
intStart = intStart + 1
-
WEND
Just make sure all boxes are there and that the BkdEndTimeID has a value.
Getting the idea ?
Nic;o)
Hi Nic
Thanks for your help....
I can get it working to an extent if i include this line i get the folloing error message...
Compile error
Invalid use of me keyword - Me.Fields ("Box" & Format(intstart, "00").BackColor = vbRed)
So i changed it to the following and when it runs this line it just ends the function. The code is within a module in a function by the way.. - Forms![F_EquipBooking]![SF_EquipBooking].Fields ("Box" & Format(intstart, "00").BackColor = vbRed)
Regards Phill
Hi Nic
Thanks for your help....
I can get it working to an extent if i include this line i get the folloing error message...
Compile error
Invalid use of me keyword
Me.Fields ("Box" & Format(intstart, "00").BackColor = vbRed)
So i changed it to the following and when it runs this line it just ends the function. The code is within a module in a function by the way..
Forms![F_EquipBooking]![SF_EquipBooking].Fields ("Box" & Format(intstart, "00").BackColor = vbRed)
Regards Phill
Hi Phill,
Sorry my error, I assumed the code to be part of the form.
Just would have thought you would need to use: - Forms![F_EquipBooking]![SF_EquipBooking].form.Fields ("Box" & Format(intstart, "00").BackColor = vbRed)
as Access requires an extra "form reference".
Nic;o)
NeoPa 32,556
Expert Mod 16PB
... - Me.Fields ("Box" & Format(intstart, "00").BackColor = vbRed)
...
The second closing parenthesis should be immediately after the first (before .BackColor). - Me.Fields("Box" & Format(intstart, "00")).BackColor = vbRed
Hi Phill,
Sorry my error, I assumed the code to be part of the form.
Just would have thought you would need to use: - Forms![F_EquipBooking]![SF_EquipBooking].form.Fields ("Box" & Format(intstart, "00").BackColor = vbRed)
as Access requires an extra "form reference".
Nic;o)
Hi,
I'm still having no luck I have tried both lines of code as follows and as soon as you run either line it just skips to end function - Forms![F_EquipBooking]![SF_EquipBooking].Form.Fields("Box" & Format(intstart, "00")).BackColor = vbRed
-
-
Forms![F_EquipBooking]![SF_EquipBooking].Form.Fields ("Box" & Format(intstart, "00").BackColor = vbRed)
what is this line supposed to do? im not sure that i understand...
Many thanks Phill
Hi,
I'm still having no luck I have tried both lines of code as follows and as soon as you run either line it just skips to end function - Forms![F_EquipBooking]![SF_EquipBooking].Form.Fields("Box" & Format(intstart, "00")).BackColor = vbRed
-
-
Forms![F_EquipBooking]![SF_EquipBooking].Form.Fields ("Box" & Format(intstart, "00").BackColor = vbRed)
what is this line supposed to do? im not sure that i understand...
Many thanks Phill
Sorry Phill, I mixed up forms and records, try: - Forms![F_EquipBooking]![SF_EquipBooking].Form.Controls("Box" & Format(intstart, "00")).BackColor = vbRed
-
-
Forms![F_EquipBooking]![SF_EquipBooking].Form.Controls("Box" & Format(intstart, "00").BackColor = vbRed)
As the fields of a form are called "Controls" :-)
Nic;o)
Sorry Phill, I mixed up forms and records, try: - Forms![F_EquipBooking]![SF_EquipBooking].Form.Controls("Box" & Format(intstart, "00")).BackColor = vbRed
-
-
Forms![F_EquipBooking]![SF_EquipBooking].Form.Controls("Box" & Format(intstart, "00").BackColor = vbRed)
As the fields of a form are called "Controls" :-)
Nic;o)
Hi Nic
Its working :) much appreciated
Phill
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Dave Robinson |
last post by:
I was wondering if anyone could help me with a problem I'm having.
I've been using Dreamweaver to create a hotel booking system for a
friend of mine, using MySQL (version 4.0.21) and PHP 5. The...
|
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...
|
by: WiseOwl |
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...
|
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...
|
by: Mike Glazer |
last post by:
I am trying to construct an Access database to be used for making bookings
to share vehicles. The user has to be able to select a starting date and
time and an ending date and time. However, when...
|
by: bredal Jensen |
last post by:
Hello gurus,
I'm building a small booking system and i have come accross quiet a tedious
pitfall.
"I need to make sure that people do not book for tomorrow when todays time
is greater or...
|
by: NDayave |
last post by:
How do,
I have a access 2000 booking database with Personal Details, Outing Details and the Bookings in three tables:
tblBookings -- -Autonumber, -Number, -Number, -Currency, -Yes/No, -Yes/No
...
|
by: Wildster |
last post by:
Hi,
I have a form in Access 2000 running Windows XP with the following fields: -
Booking_ID
Date
Person_Name
Booking_Type
8-9am (y/n checkbox)
9-10am (y/n checkbox)
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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...
|
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,...
|
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...
|
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,...
| |