Hey... googled my problem and got this site...
I am new to SQL and pretty much "winging it" as far as learning...
I have set the format on my field to mm/dd/yy to match the data that is returned.
I am using >= #mm/dd/yy# in my criteria, being >= '#06/30/07#' because I only want to see things bought the last 6 months of the year.
everything seems to look right. However, it is returning a few items from 2005? I have tried just about everything i can think of... I have posted the SQL below for suggestions!!! Thanks in advance!!! - SELECT OAUSER_ITEM.ITEM_NUMBER, OAUSER_ITEM.ITEM_DESC, OAUSER_ITEM.ITEM_DESC_2, OAUSER_ITEM.CURRENT_COST, OAUSER_ITEM.QTY_ONHAND, OAUSER_ITEM_HISTORY.LAST_PURCH_DATE
-
FROM OAUSER_ITEM LEFT JOIN OAUSER_ITEM_HISTORY ON OAUSER_ITEM.ITEM_NUMBER = OAUSER_ITEM_HISTORY.ITEM_NUMBER
-
WHERE (((OAUSER_ITEM.QTY_ONHAND)<>0) AND ((OAUSER_ITEM_HISTORY.LAST_PURCH_DATE)>="#06/30/07#"));
10 2142
Hey... googled my problem and got this site...
I am new to SQL and pretty much "winging it" as far as learning...
I have set the format on my field to mm/dd/yy to match the data that is returned.
I am using >= #mm/dd/yy# in my criteria, being >= '#06/30/07#' because I only want to see things bought the last 6 months of the year.
everything seems to look right. However, it is returning a few items from 2005? I have tried just about everything i can think of... I have posted the SQL below for suggestions!!! Thanks in advance!!!
SELECT OAUSER_ITEM.ITEM_NUMBER, OAUSER_ITEM.ITEM_DESC, OAUSER_ITEM.ITEM_DESC_2, OAUSER_ITEM.CURRENT_COST, OAUSER_ITEM.QTY_ONHAND, OAUSER_ITEM_HISTORY.LAST_PURCH_DATE
FROM OAUSER_ITEM LEFT JOIN OAUSER_ITEM_HISTORY ON OAUSER_ITEM.ITEM_NUMBER = OAUSER_ITEM_HISTORY.ITEM_NUMBER
WHERE (((OAUSER_ITEM.QTY_ONHAND)<>0) AND ((OAUSER_ITEM_HISTORY.LAST_PURCH_DATE)>="#06/30/07#"));
I believe it could be one of two things:
First, the OAUSER_ITEM_HISTORY.LAST_PUCH_DATE might not be a set under the correct date format. Second, try removing the quotes from "#06/30/07#"
I believe it could be one of two things:
First, the OAUSER_ITEM_HISTORY.LAST_PUCH_DATE might not be a set under the correct date format. Second, try removing the quotes from "#06/30/07#"
how do you change the date format for OAUSER_ITEM_HISTORY.LAST_PUCH_DATE?????
Hey... googled my problem and got this site...
I am new to SQL and pretty much "winging it" as far as learning...
I have set the format on my field to mm/dd/yy to match the data that is returned.
I am using >= #mm/dd/yy# in my criteria, being >= '#06/30/07#' because I only want to see things bought the last 6 months of the year.
everything seems to look right. However, it is returning a few items from 2005? I have tried just about everything i can think of... I have posted the SQL below for suggestions!!! Thanks in advance!!!
SELECT OAUSER_ITEM.ITEM_NUMBER, OAUSER_ITEM.ITEM_DESC, OAUSER_ITEM.ITEM_DESC_2, OAUSER_ITEM.CURRENT_COST, OAUSER_ITEM.QTY_ONHAND, OAUSER_ITEM_HISTORY.LAST_PURCH_DATE
FROM OAUSER_ITEM LEFT JOIN OAUSER_ITEM_HISTORY ON OAUSER_ITEM.ITEM_NUMBER = OAUSER_ITEM_HISTORY.ITEM_NUMBER
WHERE (((OAUSER_ITEM.QTY_ONHAND)<>0) AND ((OAUSER_ITEM_HISTORY.LAST_PURCH_DATE)>="#06/30/07#"));
Don't put (") quotes around your date.
((OAUSER_ITEM_HISTORY.LAST_PURCH_DATE)>=#06/30/07#));
If you are working in the query builder in Access you don't need to include the # signs, Access will include automatically if it needs.
If I take out just the ' marks, if I take out just the #;s, and if I take out both it doesn't return anything for any option???
how do you change the date format for OAUSER_ITEM_HISTORY.LAST_PUCH_DATE?????
You have to view the table in "design view". This is where each column of the table is assigned a data type.
NOTE: I would not change table settings for it might cause you greater problems.
I would first start with removing the double quotes first. If they reappear after you remove them.
This would indicate that the OAUSER_ITEM_HISTORY.LAST_PUCH_DATE is set to a Text data type in the table design. It order to get the results you want, the data type this field must be set to date and formatted to be mm/dd/yy
JS
The data type in Design View under properties is set to mm/dd/yy to match the info returned by Query...
is this what you mean... if not how would I change it from text to mm/dd/yy???
again, thank you for all of your help!
Try this:
If LAST_PURCH_DATE is in a viable date/string format then CDate function will convert it to a true date format. - SELECT OAUSER_ITEM.ITEM_NUMBER, OAUSER_ITEM.ITEM_DESC, OAUSER_ITEM.ITEM_DESC_2, OAUSER_ITEM.CURRENT_COST, OAUSER_ITEM.QTY_ONHAND, OAUSER_ITEM_HISTORY.LAST_PURCH_DATE
-
FROM OAUSER_ITEM LEFT JOIN OAUSER_ITEM_HISTORY ON OAUSER_ITEM.ITEM_NUMBER = OAUSER_ITEM_HISTORY.ITEM_NUMBER
-
WHERE (OAUSER_ITEM.QTY_ONHAND)<>0) AND (CDate(OAUSER_ITEM_HISTORY.LAST_PURCH_DATE)>=#06/30/2007#);
Try this:
If LAST_PURCH_DATE is in a viable date/string format then CDate function will convert it to a true date format.
SELECT OAUSER_ITEM.ITEM_NUMBER, OAUSER_ITEM.ITEM_DESC, OAUSER_ITEM.ITEM_DESC_2, OAUSER_ITEM.CURRENT_COST, OAUSER_ITEM.QTY_ONHAND, OAUSER_ITEM_HISTORY.LAST_PURCH_DATE
FROM OAUSER_ITEM LEFT JOIN OAUSER_ITEM_HISTORY ON OAUSER_ITEM.ITEM_NUMBER = OAUSER_ITEM_HISTORY.ITEM_NUMBER
WHERE (OAUSER_ITEM.QTY_ONHAND)<>0) AND (CDate(OAUSER_ITEM_HISTORY.LAST_PURCH_DATE)>=#06/30/2007#);
It says that there is a data type mismatch in criteria expression error? ...
This is ridiculous... I cannot figure this out to save my life...
sheesh...
It says that there is a data type mismatch in criteria expression error? ...
This is ridiculous... I cannot figure this out to save my life...
sheesh...
With the Mismatch error then the "actual data" is not in a recognizable date format. This may not be true for all records tho. Are some of the date values Null, some other value or multiple input variations (I.E. "Missing Date", "Error", 2008/01/15, 010108, etc,)? This can cause the calculations to fail.
Sort the data by that date column in ascending order and look at the dates and then in descending order and lokk at dates. You may find some records with erroneous entries or formats the may need correcting first.
NeoPa 32,557
Recognized Expert Moderator MVP
...
This would indicate that the OAUSER_ITEM_HISTORY.LAST_PUCH_DATE is set to a Text data type in the table design. It order to get the results you want, the data type this field must be set to date and formatted to be mm/dd/yy
JS
Not entirely true as any date format will be irrelevant (just being picky for the sake of full accuracy you understand - No criticism intended).
Any date is matched on m/d/y format in SQL (In GB we use d/m/y as standard - doesn't matter - have to use m/d/y in SQL).
See Literal DateTimes and Their Delimiters (#) for full explanation.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: vnl |
last post by:
I'm trying to run a SQL query but can't find any records when trying to
select a certain date. Here's the sql:
SELECT field 1, field2, date_and_time,
FROM table1
WHERE date_and_time =...
|
by: BlackFireNova |
last post by:
I need to write a report in which one part shows a count of how many
total records fall within the working days (Monday - Friday) inside of a
(prompted) given date range, in a particular...
|
by: Steve Elliott |
last post by:
I have a query set up to gather together data between two specified dates.
Shown in the query column as:
Between #24/09/2004# And #01/10/2004#
Is it possible to enter several different date...
|
by: manning_news |
last post by:
Using A2K. I've been asked to modify a report currently requiring only
one date parameter to now accept a date range. The main report has 2
subreports and is not bound to a table or query. The...
|
by: John Wildes |
last post by:
Hello all
I'm going to try and be brief with my question, please tell me if I have the
wrong group.
We are querying transaction data from a DB3 database application. The dates
are stored as...
| |
by: PC Datasheet |
last post by:
Transaction data is given with date ranges:
Beginning End
4/1/06 4/4/06
4/7/06 4/11/06
4/14/06 4/17/06
4/18/06 4/21/06
426/06 ...
|
by: rdemyan via AccessMonster.com |
last post by:
I have a need to highlight a date range in a bar chart. If the
"highlighting" is accomplished by changing the bar column color for the
specific months in the date range, that would be great.
...
|
by: Thorben Grosser |
last post by:
Hey again newsgroup,
I am still working on an archive database and got another problem: I
have to classify the folders by a date or a date range which has the
format mm/yyyy
I got the feeling,...
|
by: Sandboxer |
last post by:
I want to be able to program Access to provide for me, by individual day, what my contract obligations are to my customers. Will Access recognize all the individual days in between a date range...
|
by: Deano |
last post by:
The short version;
In short, given one date range (start and end dates) how can I find the
period that overlaps with another date range?
The long version;
I have knocked up a little application...
|
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: 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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |