WHERE DateDiff('d',[From date],[DatumStvoreni])>0
I have the exact expression in the SELECT clause and it show positive and
negative integers just fine, but when I add this test, I get the error.
There are no bad values in the dataset, I've looked, and when I export the
DateDiff column to a temp table and run a query on that, it works fine. Only
when I use the test directly with the DateDiff function does it bomb. I also
tried putting CDate() around the field expressions and it didn't help.
Pete
--
This e-mail address is fake, to keep spammers and their address harvesters
out of my hair. If you want to get in touch personally, I am 'pdanes' and I
use yahoo mail. But please use the newsgroup when possible, so that all may
benefit from the exchange of ideas.
I get an error when I use single quotes. I have to use this:
DateDiff("d",[From date],[DatumStvoreni])
The whole expression I tried was this:
WHERE (DateDiff("d",[From date],[DatumStvoreni])>0)
Tom Lake
SELECT Stvoreni_Convert.DatumStvoreni, DateDiff("d",[From
date],[DatumStvoreni]) AS Rozdil, Stvoreni_Convert.AkcesPodrobnostiAutoID
INTO STV
FROM Stvoreni_Convert
WHERE (((DateDiff("d",[From date],[DatumStvoreni]))>0));
The source of that query is this one (Stvoreni_Convert):
SELECT Stvoreni.Stvoreni, getdate([stvoreni]) AS DatumStvoreni,
Stvoreni.AkcesPodrobnostiAutoID
FROM Stvoreni
WHERE (((getdate([stvoreni]))<>''));
and the source of that one is here(Stvoreni):
SELECT IIf(InStrRev(nz([Inventarizace]),Chr(13) &
Chr(10))>0,Mid(nz([Inventarizace]),2+InStrRev(nz([Inventarizace]),Chr(13) &
Chr(10))),nz([Inventarizace])) AS Stvoreni,
AkcesPodrobnosti.AkcesPodrobnostiAutoID
FROM AkcesPodrobnosti
WHERE (((nz([Inventarizace]))<>'') AND ((AkcesPodrobnosti.EvidenceLetter) Is
Not Null));
AkcesPodrobnosti is a table, with Inventarizace as a memo field.
Getdate is a VBA function extracts a date from a mess of text and returns it
as a string.
All the preceding works fine, until I add the WHERE clause in the top query.
Pete
"Tom Lake" <toml_...@hotmail.com> p�se v diskusn�m pr�spevku
news:uFzLV2u6...@TK2MSFTNGP05.phx.gbl...
SELECT Stvoreni_Convert.DatumStvoreni, CDate([DatumStvoreni]) AS Rozdil,
Stvoreni_Convert.AkcesPodrobnostiAutoID INTO STV
FROM Stvoreni_Convert
WHERE (((CDate([DatumStvoreni]))>CDate([From date])));
Pete
"Tom Lake" <toml_...@hotmail.com> p�se v diskusn�m pr�spevku
news:uFzLV2u6...@TK2MSFTNGP05.phx.gbl...
>
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
"Petr Danes" <skrusp...@no.spam> wrote in message
news:uT4baAv6...@TK2MSFTNGP06.phx.gbl...
Pete
"Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_gmail.com> p�e v diskusn�m
p��sp�vku news:e6r7sOw6...@TK2MSFTNGP04.phx.gbl...
> You sure you've got valid values for both fields in every row?
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no private e-mails, please)
>
>
> "Petr Danes" <skrusp...@no.spam> wrote in message
> news:uT4baAv6...@TK2MSFTNGP06.phx.gbl...
>>I just tried the last query in another form, using a direct comparison
>>instead of the DateDiff function. Same error.
>>
>> SELECT Stvoreni_Convert.DatumStvoreni, CDate([DatumStvoreni]) AS Rozdil,
>> Stvoreni_Convert.AkcesPodrobnostiAutoID INTO STV
>> FROM Stvoreni_Convert
>> WHERE (((CDate([DatumStvoreni]))>CDate([From date])));
>>
>> Pete
>>
>>
>>
>> "Tom Lake" <toml_...@hotmail.com> p�se v diskusn�m pr�spevku
Year-month-day is the only universally correct way to show dates anyway, but
it's pretty lame that dates can't be compared directly.
Pete
"Petr Danes" <skrusp...@no.spam> p锟絜 v diskusn锟絤 p锟斤拷sp锟絭ku
news:OqbHUsu...@TK2MSFTNGP02.phx.gbl...