PDA

View Full Version : Invalid date value in expression builder


JoeMicro
Aug 28, 2009, 01:32 PM
Hi,

I want to sum a column on an unbound subform based on a txtbox on the main form, so I entered this
Sum(IIf([CheckDate]>=[Forms]![frmStatements]![txtDate] ,[Quantity],0)) in a textbox on the subform but I get #Error in the txtbox.

So I tried adding # so I get an error "the expression you entered has an invalid date value"?

Any help would be appreciated.

Joe

ScottGem
Aug 28, 2009, 03:03 PM
Try this as the ControlSource of the textbox:


=DSum("[Quantity]","tablename","[CheckDate] > #" &
Forms]![frmStatements]![txtDate] & "#")

JoeMicro
Aug 29, 2009, 09:54 PM
Thanks Scott,

I tried u'r solutions I changed "tablename" to my table name (and that's all I did) and I get the message "The expression you entered contains invalid syntax"

The reason why I don't want to use "Dfunctions" is because its not being constantly updated as records are being entered in the subform unlike the sum iif function.

Any other suggestions you could think of?

Thank you again
Joe.

JoeMicro
Sep 9, 2009, 07:11 PM
Any ideas anybody?