So confused about filtering a calculation

  • Thread starter Thread starter Stephen
  • Start date Start date
S

Stephen

I have the following line of code and just cant get the filter to work. I
know its a simple thing but im stuck. Every time the line is executed i get
a exception on the month function....

FormatNumber(Str((myCount.Tables(0).Compute("AmountShipped)",
Month("DateShipped") = 5))), 0)



thanks...

steve
 
Was the " around the AmountShipped a typo? It should be inside the ).

FormatNumber(Str((myCount.Tables(0).Compute("AmountShipped)",
Month("DateShipped") = 5))), 0)

What is the exception say?

Chris
 
Thanks for the response.. yea it was a typo.. the exception i get is :

Additional information: Cast from string "DateShipped" to type 'Date' is not
valid.
 
The second part of the Compute method is suppose to be a string. In your
case you are trying to convert the string "DateShipped" to a date. Try this
but I make no promises it will work, I haven't tried it.

FormatNumber(Str((myCount.Tables(0).Compute("AmountShipped"),
"Month("DateShipped"") = 5"))), 0)

Chris
 
hey chris.... couldnt get it to work so I opted to reset the sqlstatement as
follows:
"SELECT Id,DateShipped,amountShipped, Month(DateShipped) as
MMonth,Year(DateShipped) as MYear from " & _

"Detail order by dateshipped desc"



and filing the dataset with the interger values on the month and date
functions. Anyway, thank you for the idea's and help



Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top