Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Query - DateSerial Anomaly

Status
Not open for further replies.

SkipVought

Programmer
Dec 4, 2001
47,492
US

When I use
Code:
DateSerial(Year(Date()+90), Month(Date()+90)+1, 0)
in the Select Clause, it returns a valid end-of-month date.

in the Where Clause, I get an error
[tt]
Wrong number of arguments used with function in query expression
'(MOI.PCT<=DateSerial(Year(Date()+90),Month(Date()+90)+#1/1/2000 00:00:00#))'.
[/tt]
Any ideas?

Skip,

[glasses] [red][/red]
[tongue]
 
(MOI.PCT<=DateSerial(Year(Date()+90),Month(Date()+90)+[!]1,0[/!])

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PH,

The MS Query Editor is taking
[tt]
MOI.PCT<=DateSerial(Year(Date()+90), Month(Date()+90)+1, 0)
[/tt]
and interpreting it as
[tt]
(MOI.PCT<=DateSerial(Year(Date()+90),Month(Date()+90)+#1/1/2000 00:00:00#))
[/tt]
Code:
SELECT MOI.PART_ID, MOI.MFG_ORD, MOI.PROGRAM, MOI.RC, MOI.LPCT, MOI.CURRENT_OP

FROM  `\\dfwsrv222\public\HeldForMaterial\HFM`.FPRPTSAR_MFG_ORDER_INFO MOI

WHERE MOI.PCT <= DateSerial(Year(Date()+90), Month(Date()+90)+1, 0)
[tt]
[highlight blue][white] Microsoft Query [/white][/highlight][highlight white]
Wrong number of arguments used with function in query expression
'(MOI.PCT<=DateSerial(Year(Date()+90),Month(Date()+90)+#1/1/2000 00:00:00#))'.[/highlight]
[/tt]


Skip,

[glasses] [red][/red]
[tongue]
 



This seems to work...
Code:
WHERE MOI.PCT <= DateSerial(Year(Date()+90), Month(Date()+90)+Val(1), Val(0))


Skip,

[glasses] [red][/red]
[tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top