473,326 Members | 2,815 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.

How to query for an interval between 18 and 6 (hours, as integer in the table)?

Dear all,

Probably this is a stupid question but I'm new to access.
I am trying to select from "Ora" column in the table (picture attached) values between 18 and 6. All my filtering works until here. "Ora" is defined as integer, data is inserted into the table by an external app. I cannot modify this field as the external app cannot send the date/time in a different format.

Istoric_Turnari - the table that i am trying to query
Forms!Rap_Tura!An_cal - the selected year inside Rap_Tura form
etc etc

I am trying this(one of the many sollutions that I tried):

SELECT *
FROM Istoric_Turnari IN 'C:\Istoric.mdb'
WHERE Istoric_Turnari.An=Forms!Rap_Tura!An_cal And Istoric_Turnari.zi Between 7 And 8 And Istoric_Turnari.ora>=18 And Istoric_Turnari.ora<=6;
Attached Images
File Type: jpg Istoric.jpg (81.4 KB, 250 views)
Feb 8 '11 #1
3 1748
orangeCat
83 64KB
Istoric_Turnari.ora>=18 And Istoric_Turnari.ora<=6;

I don't think this is possible,
What can be greater or equal 18 AND Less than or equal 6

Do you mean
Istoric_Turnari.ora>=6 And Istoric_Turnari.ora<=18

Note you could use the Between operator. In Access it includes endpoints.
Feb 8 '11 #2
I got it!

Thanks orangeCat for your quick reply.
Actually what I wanted to do was to select from the table the batches feeded between 19:00 hrs to 7:00 (The night shift). For the day shift it was easy, using "between 7 and 19".
Following I am posting the "winning formula", if someone ever bumps into this. It's tested and working well. I hope it makes sense, as it uses form data.

SELECT *
FROM Istoric_Turnari IN 'C:\Istoric.mdb'
WHERE Istoric_Turnari.An=Forms!Rap_Tura!An_Cal
And
((Istoric_Turnari.Zi=Forms!Rap_Tura!Zi_Cal
and
Istoric_Turnari.ora>=Forms!Rap_Tura!Inc_Sch)
Or
(Istoric_Turnari.Zi=Forms!Rap_Tura!ZiSc2
and
Istoric_Turnari.ora<=Forms!Rap_Tura!Sf_Sch));
Feb 8 '11 #3
As a legend:
Zi_Cal - the selected day
Inc_Sch - Shift start hour
ZiSc2 - the selected day +1 (day in which the shift ends)
Sf_Sch - Shift end hour
Feb 8 '11 #4

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

Similar topics

2
by: Felix | last post by:
Hi, I've a problem: I want to have the result of my Mysql Query in a Table in my php file. Now I've this: <?
2
by: sreddy | last post by:
I am trying to write a sql query on self referencing table. Just to brief ..Database is related to a Hiring department of the Qwest company. I need to generate a Report used by in HR...
6
by: David Shorthouse | last post by:
Hello folks, I have a problem with an update query on an asp not updating the table in an Access db. The code runs, I have no errors, but when I examine the table, nothing was updated. The query...
21
by: CSN | last post by:
I have a pretty simple select query that joins a table (p) with 125K rows with another table (pc) with almost one million rows: select p.* from product_categories pc inner join products p on...
16
by: tyrfboard | last post by:
I've been searching for awhile now on how to remove duplicates from a table within an Access db and have found plenty of articles on finding or deleting duplicates. All I want to do is remove them...
6
by: jjturon | last post by:
Can anyone help me?? I am trying to pass a Select Query variable to a table using Dlookup and return the value to same select query but to another field. Ex. SalesManID ...
3
by: Galka | last post by:
Hello Why do you think a create table query doesn't create table from the following code? Set myQuery = myDB.QueryDefs("qryCON absent adults previous day log") myQuery.Execute If I execute...
27
by: MLH | last post by:
How can I turn the following into a make-table query? SELECT & " " & AS Recipient FROM tblVehicleJobs INNER JOIN tblAddnlOwnrs ON tblVehicleJobs.VehicleJobID = tblAddnlOwnrs.VehicleJobID WHERE...
2
by: scolivas | last post by:
Is there a way to automate this process? I have a query that finds the "Drop Offs" by doing an unmatch query against the hard table and the live table. I want to automatically pull these...
1
by: sshafer1 | last post by:
I have a form that is using query as the backend 'table'. I did this so that I could display query fields in my form that have been calculated. 1. How do I write those query field values to a...
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...
0
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...
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work

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.