473,762 Members | 8,598 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

date conversion

I need to write an access query that will pull records from a table if
the start or end dates input by the user are within the start and end
dates in the db. I can't use BETWEEN because either of the dates in
the db may be outside those input. Basically it's something like:

select where input.startdate <= tbl.startdate or input.endate >=
tbl.enddate

so that if the query date are start 04/01/2000 and end 09/31/2000 it
will return records with start 01/01/2000 and 06/31/2001 because the
input dates are between the record dates.

Is this possible??

There is a DATE function in access that will convert a date to a
serial number which would let me do the math but I think it needs the
year, month and day to be entered as separate parameters:
DATE(year,month ,day). Is there anything that will let me just convert
a date to an number in a query?

Thanks for the help.
b
Nov 12 '05 #1
2 6525
So what's wrong with:

SELECT Staff.StaffID, Staff.StaffName , Staff.MgrID, Staff.Level
FROM Staff
WHERE (((Staff.MgrID) Not Between 3 And 4));
if you use NOT BETWEEN x AND y, you'll get all the values that are not
in that range...

say I have {1,2,3,4,5} as my entire range of X, and I ask for

SELECT X
FROM Table
WHERE Table.X NOT BETWEEN 2 AND 4;

I get {1,5} as the result set. Is that what you were after?
Nov 12 '05 #2

You can seperate a date by using

Year(myDate)
Month(myDate)
Day(myDate)

and put it back together using

DateSerial(myYe ar, myMonth, myDay)

Don't forget the # symbols around your dates in the SQL statement, or
convert the string returned to a date :)

eg. SELECT * FROM myTable WHERE myTable![StartDate] >= CDate([Enter Start
Date]) OR myTable![EndDate] <= CDate([Enter End Date])

--
Bradley
Software Developer www.hrsystems.com.au
A Christian Response www.pastornet.net.au/response

"B Briant" <br*****@rogers .com> wrote in message
news:8e******** *************** ***@posting.goo gle.com...
I need to write an access query that will pull records from a table if
the start or end dates input by the user are within the start and end
dates in the db. I can't use BETWEEN because either of the dates in
the db may be outside those input. Basically it's something like:

select where input.startdate <= tbl.startdate or input.endate >=
tbl.enddate

so that if the query date are start 04/01/2000 and end 09/31/2000 it
will return records with start 01/01/2000 and 06/31/2001 because the
input dates are between the record dates.

Is this possible??

There is a DATE function in access that will convert a date to a
serial number which would let me do the math but I think it needs the
year, month and day to be entered as separate parameters:
DATE(year,month ,day). Is there anything that will let me just convert
a date to an number in a query?

Thanks for the help.
b

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
2188
by: nimish | last post by:
I have Month, Day and Year fields on my form. When I submit this form I want to create a valid date from all three fields before inserting into MYSQL table. I tried following: $dob=$Month."-".$Day."-".$Year; $dob = strtotime($dob); But it does not update my date field in the table. I am novice in PHP, do you know where i am making a mistake.
5
16090
by: SalimShahzad | last post by:
Dear Respected Gurus, I need a coding assistant converting from gregorian to hijri and vice versa. I have problem with this codes. the problem Gregorian to Hijri gives 100% results. when i enter this to Hijri to gregorian it either do nothing or go to next record on form. well there r two fields on form that r calc afterevents each other dates. ur assistance will be highly appreciated, if any one can tell what is wrong with this codes
4
1625
by: dhnriverside | last post by:
Hi peeps I have a datepicker control that's providing dates in the format dd/mm/yyyy (UK). I want to convert this to "yyyy-mm-dd" to store as a text field in my database (had lots of problems with date conversions using "proper" data fields). I used to use ASP, and it was easy, using a combination of Left() Mid() and
1
1640
by: Franck | last post by:
Hi, 'm gettin mad about date conversion. Here is the point. Got and add-in for Excel which call functions from a web service (on a remote server) The remote server has regional settings set to "en-UK" and date to dd/MM/yyyy. (I'can't change it !)
1
3237
by: vadala | last post by:
The requirement is to send start data and end date from java to UI (.net) for a functionality. We are setting the time in java (1.5) before handing it over to WebService (sending to UI ) in "ASIA/KUALA_LUMPUR" (MYT) TIMEZONE. OS WIN-XP Strangely UI receives a different date. java side UI side
7
3010
by: bruce.dodds | last post by:
Access seems to be handling a date string conversion inconsistently in an append query. The query converts a YYYYMM string into a date, using the following function: CDate(Right(,2) & "/1/" & Left(,4)) I entered the string "200715" in a record to test an error condition.
2
5419
by: p.smachylo | last post by:
Hello, I am relatively new to Microsoft Access and databases in general, and have a problem - one which I think may necessitate some VBA code (or maybe just modification of the criteria section of the query. I have a table with several columns being imported into a query which will eventually be used in a report. One of the fields in the database is called 'Predicted Completion Date' and is in the format: Q# Year (formatted as text)....
2
5153
by: RN1 | last post by:
A TextBox displays the current date (in dd/mm/yyyy format) & time when a user comes to a page (e.g. 15/10/2008 1:36:39 PM). To convert the date into international format so that the remote server doesn't generate any error, this is what I am doing: --------------------------- Dim strSDate As String Dim strSTime As String Dim strStartDT As String Dim strSDateTime As String
2
2123
by: anderst | last post by:
Hi! I need help with date conversion, I need a perl-script that transform Wed Mar 28 00:00:00 GMT+02:00 2007 to 2007-03-28 I have tried to use perl modules Date::Manip and Date::Calc, but no succes so far. Maybe I am doing it the wrong way.
4
2132
maheshwag
by: maheshwag | last post by:
my code is: string sql="insert into dummy(date)values(@date) sqlcommand cmd=new sqlcommand(sql,con) cmd.parameters.Add("@date", SqlDbtype.datetime).values=maskedtextbox1.text; cmd.ExecuteNonquery();
0
10137
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9989
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9927
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9812
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8814
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7360
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5268
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3914
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3510
muto222
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.