473,399 Members | 3,888 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,399 software developers and data experts.

Query Criteria

121 100+
Hi,

I am trying to write a query that does not display a record according to criteria

The database is a room and equipment booking database the form displays the room details and the equipment that is booked to that room.

This is displayed in a continuous form using text boxes that represent an hours time slot so if the equipment is booked form 09:00 - 12:00 the three text boxes representing the time 09:00 - 12:00 are set to change colour.

This is done using conditional formating so the text boxes need to be bound to a table because it is on a continuous form.

In the form header the room booking details are displayed so for example

Room 1

15/3/2010 09:00 - 12:00 (this is the room booking date and the duration)

So for example the records look something like this

Equip1 09:00 10:00 11:00 00:00 00:00 00:00 00:00 00:00 etc
Equip2 00:00 00:00 00:00 00:00 00:00 14:00 15:00 16:00 etc


So Equip1 is booked for one three hourly slot 09:00 - 12:00 which is within the room booking duration

and Equip2 is booked from 14:00 - 17:00 which is not booked within the room booking duration

So if the field has a value the conditional formating displays that field in red if the field is set to 00:00 then the field is displayed in green meaning the equipment is available.

So what I am trying to achieve is to display the equipment that is only available for the ROOM booking duration

So in effect the query would only display the record for Equip2 because Equip1 is already booked elsewhere for 09:00 10:00 and 11:00 which is within the duration of the room booking and Equip2 is not booked for the room booking duration so Equip2 is available to book.

Here is the query that I am trying to get to work

Expand|Select|Wrap|Line Numbers
  1. SELECT TblAssetLocal.ID, TblAssetLocal.Model, TblAssetLocal.Manufacturer, TblAssetLocal.Category, TblAssetLocal.AssetDetails, TblAssetLocal.Details, TblAssetLocal.Details1, TblAssetLocal.[08:00], TblAssetLocal.[09:00], TblAssetLocal.[10:00], TblAssetLocal.[11:00], TblAssetLocal.[12:00], TblAssetLocal.[13:00], TblAssetLocal.[14:00], TblAssetLocal.[15:00], TblAssetLocal.[16:00], TblAssetLocal.[17:00], TblAssetLocal.[18:00], TblAssetLocal.[19:00], TblAssetLocal.[20:00], TblAssetLocal.[21:00], TblAssetLocal.[22:00], TblAssetLocal.[23:00], TblAssetLocal.[00:00], TblAssetLocal.BookableOnsite, TblAssetLocal.Description, TblAssetLocal.BookEquip, TblAssetLocal.StartTime, TblAssetLocal.EndTime, TblAssetLocal.Machine
  2. FROM TblAssetLocal
  3. WHERE ((Not (TblAssetLocal.[09:00])>=[Forms]![frmEquipBooking]![TxtStartTime] And (TblAssetLocal.[09:00])<[Forms]![frmEquipBooking]![TxtEndTime]) AND (Not (TblAssetLocal.[10:00])>=[Forms]![frmEquipBooking]![TxtStartTime] And (TblAssetLocal.[10:00])<[Forms]![frmEquipBooking]![TxtEndTime]) AND (Not (TblAssetLocal.[11:00])>=[Forms]![frmEquipBooking]![TxtStartTime] And (TblAssetLocal.[11:00])<[Forms]![frmEquipBooking]![TxtEndTime]) AND (Not (TblAssetLocal.[12:00])>=[Forms]![frmEquipBooking]![TxtStartTime] And (TblAssetLocal.[12:00])<[Forms]![frmEquipBooking]![TxtEndTime]) AND (Not (TblAssetLocal.[13:00])>=[Forms]![frmEquipBooking]![TxtStartTime] And (TblAssetLocal.[13:00])<[Forms]![frmEquipBooking]![TxtEndTime]) AND (Not (TblAssetLocal.[14:00])>=[Forms]![frmEquipBooking]![TxtStartTime] And (TblAssetLocal.[14:00])<[Forms]![frmEquipBooking]![TxtEndTime]) AND (Not (TblAssetLocal.[15:00])>=[Forms]![frmEquipBooking]![TxtStartTime] And (TblAssetLocal.[15:00])<[Forms]![frmEquipBooking]![TxtEndTime]) AND (Not (TblAssetLocal.[16:00])>=[Forms]![frmEquipBooking]![TxtStartTime] And (TblAssetLocal.[16:00])<[Forms]![frmEquipBooking]![TxtEndTime]) AND (Not (TblAssetLocal.[17:00])>=[Forms]![frmEquipBooking]![TxtStartTime] And (TblAssetLocal.[17:00])<[Forms]![frmEquipBooking]![TxtEndTime]) AND (Not (TblAssetLocal.[18:00])>=[Forms]![frmEquipBooking]![TxtStartTime] And (TblAssetLocal.[18:00])<[Forms]![frmEquipBooking]![TxtEndTime]) AND (Not (TblAssetLocal.[19:00])>=[Forms]![frmEquipBooking]![TxtStartTime] And (TblAssetLocal.[19:00])<[Forms]![frmEquipBooking]![TxtEndTime]) AND (Not (TblAssetLocal.[20:00])>=[Forms]![frmEquipBooking]![TxtStartTime] And (TblAssetLocal.[20:00])<[Forms]![frmEquipBooking]![TxtEndTime]) AND (Not (TblAssetLocal.[21:00])>=[Forms]![frmEquipBooking]![TxtStartTime] And (TblAssetLocal.[21:00])<[Forms]![frmEquipBooking]![TxtEndTime]) AND (Not (TblAssetLocal.[22:00])>=[Forms]![frmEquipBooking]![TxtStartTime] And (TblAssetLocal.[22:00])<[Forms]![frmEquipBooking]![TxtEndTime]) AND (Not (TblAssetLocal.[23:00])>=[Forms]![frmEquipBooking]![TxtStartTime] And (TblAssetLocal.[23:00])<[Forms]![frmEquipBooking]![TxtEndTime]) AND (Not (TblAssetLocal.[00:00])>=[Forms]![frmEquipBooking]![TxtStartTime] And (TblAssetLocal.[00:00])<[Forms]![frmEquipBooking]![TxtEndTime]) AND ((TblAssetLocal.BookableOnsite)=True) AND ((TblAssetLocal.Machine) Is Null));
Any help is much appreciated

Regards Phill
Mar 18 '10 #1
0 938

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

Similar topics

3
by: Steve | last post by:
Form FrmRestock's recordsource is QryFrmRestock. The TransactionDate field's criteria is set ats: Forms!FrmRestock!LastXDays. LastXDays on the form is a combobox where the selections are 30, 60...
6
by: Andy | last post by:
Hello, I am having many problems with setting up a parameter query that searches by the criteria entered or returns all records if nothing is entered. I have designed an unbound form with 3...
3
by: Pea | last post by:
Is it possible to get the average in a query where I have multiple criteria? Here's an abbreviated example of the query in design view: Fields: USERID DATE TIME ID_TYPE...
5
by: SuffrinMick | last post by:
Hello - I'm a newbie to coding! I'm working on an access 2000 database which has three tables: tblContacts - A list of customer contacts. tblOrgTypes - A list of organisational types....
2
by: Matthew | last post by:
Hey , I have built a query which takes values from unbounded fields on a form, and it all works except for one thing. I have a few fields in my query that are dates. I also have a start and...
0
by: starace | last post by:
I have designed a form that has 5 different list boxes where the selections within each are used as criteria in building a dynamic query. Some boxes are set for multiple selections but these list...
0
by: MLH | last post by:
I have an A97 query (qryVehiclesNowners2) that has a table field in it named . Depending on the selections made in a number of criteria choices on a form, a field on the form will have string...
3
by: MLH | last post by:
Am repeating question with different subject heading, perhaps stating more clearly my problem... I have an A97 query (qryVehiclesNowners2) that has a table field in it named . Depending on the...
6
by: Vince | last post by:
Hello all, I am using Visual Basic to open a saved query and then save information in the query to an array for later use. The problem is that the same query shows different results when opened...
6
by: jmarcrum | last post by:
Hi! I have created a Union Query in ACCESS 2003, that combines 130 records from one query (Extra Foreman Radios) and 250 records from another query (Forman Main Radios). I have created a...
0
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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,...

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.