Hi im a bit stuck on querying with dates. ive got a databse that querries using sql in visual basic 6.
I need to select only the dates which have passed or are today.
But the query returns all the records regardless of if the date has not passed
eg -
todaydate = format(date, "dd/mm/yyyy")
-
frmCars.Cars_Data.RecordSource = "select * from car_Rentals WHERE (Format(due_service,'dd/mm/yyyy') >= " & "'" & todaydate & "') And (Format(due_service,'dd/mm/yyyy') = " & "'" & todaydate & "')"
-
frmcars.cars_data.refresh
I also tried like this -
todaydate = format(date, "dd/mm/yyyy")
-
frmCars.Cars_Data.RecordSource = "select * from car_Rentals WHERE (Format(due_service,'dd/mm/yyyy') > " & "'" & todaydate & "') And (Format(due_service,'dd/mm/yyyy') = " & "'" & todaydate & "')"
-
frmcars.cars_data.refresh
And like this -
todaydate = format(date, "dd/mm/yyyy")
-
frmCars.Cars_Data.RecordSource = "select * from car_Rentals WHERE (Format(due_service,'dd/mm/yyyy') >= " & "'" & todaydate & "'"
-
frmcars.cars_data.refresh
They all had a result either consisting only of one that was equl to the current date or all of the records.
in advance Thanks ........Extremely Thankfull for any tips
7 1430
Hi im a bit stuck on querying with dates. ive got a databse that querries using sql in visual basic 6.
I need to select only the dates which have passed or are today.
But the query returns all the records regardless of if the date has not passed
eg -
todaydate = format(date, "dd/mm/yyyy")
-
frmCars.Cars_Data.RecordSource = "select * from car_Rentals WHERE (Format(due_service,'dd/mm/yyyy') >= " & "'" & todaydate & "') And (Format(due_service,'dd/mm/yyyy') = " & "'" & todaydate & "')"
-
frmcars.cars_data.refresh
I also tried like this -
todaydate = format(date, "dd/mm/yyyy")
-
frmCars.Cars_Data.RecordSource = "select * from car_Rentals WHERE (Format(due_service,'dd/mm/yyyy') > " & "'" & todaydate & "') And (Format(due_service,'dd/mm/yyyy') = " & "'" & todaydate & "')"
-
frmcars.cars_data.refresh
And like this -
todaydate = format(date, "dd/mm/yyyy")
-
frmCars.Cars_Data.RecordSource = "select * from car_Rentals WHERE (Format(due_service,'dd/mm/yyyy') >= " & "'" & todaydate & "'"
-
frmcars.cars_data.refresh
They all had a result either consisting only of one that was equl to the current date or all of the records.
in advance Thanks ........Extremely Thankfull for any tips
Try to use Between...And Operator
use # instead of & around date fields
I need to select only the dates which have passed or are today.
as per your statment , what about using OR operator instead of AND in the sql statment.
as per your statment , what about using OR operator instead of AND in the sql statment.
Thanks for your replies ill try them out thanks il psot again if ang problems
Ps i did you or as well........ i reckd my brains out lookin for solution
Hi guys......
I tried to change the & to # but this did not work it kept on comming up with error messages. Can someone please post the code that is correct cause im also confused as to which bit i have to apply the #.
Thanks.....
Also regarding the post mentioning between. i tried it but am not familiar with how it works.
Hi guys......
I tried to change the & to # but this did not work it kept on comming up with error messages. Can someone please post the code that is correct cause im also confused as to which bit i have to apply the #.
Thanks.....
Also regarding the post mentioning between. i tried it but am not familiar with how it works.
Ps please note this is for my a level so only teech me how to put the # in ect
Thanks
Hi Daniel
Does your due_service and todaydate are of both date datatypes? Try to omit the format function then in the general tab, format property of due_service select shortdate. : )
Sign in to post your reply or Sign up for a free account.
Similar topics
by: paii |
last post by:
I have a table that stores job milestone dates. The 2 milestones I am
interested in are "Ship Date" TypeID 1 and "Revised Ship Date" TypeID 18.
All jobs have TypeID 1 only some jobs have TypeID 18....
|
by: DH |
last post by:
Say I have a table with two columns that matter to this example,
and . And here is an example of what the rows
currently look like:
,
1,6/27/2001
1,6/27/2001
1,5/31/2001
2,6/27/2001...
|
by: Donna Sabol |
last post by:
First, I should start by saying I am creating a database to be used by
some very impatient, non-computer literate people. It needs to be
seameless in it's operation from their point of view. I...
|
by: Mike Cooper |
last post by:
Hi everyone,
This is a tough one. I have a database full of solicitations,
identifying a customer and recording initial call, first followup,
second followup, etc.
My boss want to be able to...
|
by: Bill R via AccessMonster.com |
last post by:
I have a query:
SELECT tblCalendar.CalendarDay AS LastSunday
FROM tblCalendar
WHERE (((tblCalendar.CalendarDay)>=(Now()-7) And (tblCalendar.CalendarDay)...
|
by: Julie Wardlow |
last post by:
Help!
I am calculating a future date using the DateAdd function in a query (the
calculation also involves an IIf statement), and have managed to get this
formula to produce the required result....
|
by: Mark Roughton |
last post by:
I have a form where the users need to view records for various
criteria, one of which is a date field on which they may wish to view
all related data for the selected date, for all dates upto and...
|
by: newnewbie |
last post by:
I have an Access database that I upload a data extract intoto daily. I want to create a query that will give me a list of dates that no data can be found for. E.g. there are no records created on the...
|
by: veaux |
last post by:
I'm thinking this is easy but can't get it. I have a table with
following:
Table1
Date 1/1/2007
Table2
Type 0107 (This is MMYY of above)
So I'm having trouble using a query to turn the...
|
by: markcarroll |
last post by:
I have a rather complicating query (the SQL is about a page long) so I hope I can solve this without needing to get into specifics.
Basically, the database I am working on has information about...
|
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
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: 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...
|
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: 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...
| |