Graph Problem

ddrew

seasoned user
Local time
Today, 23:12
Joined
Jan 26, 2003
Messages
911
I have a graph on my form that shows a dogs weight, the weights are taken monthly. As the dog gets older the graph is getting more cluttered so I want to limit the graph to show the last twlve months, I stress the last twelve months as opposed o to the alst year i.e January to January. Do I do this in the qry that I am using to fill the chart? If so how, I image I have to do it in the criteria of the WeightDate field. What would I need to write to do this, I have no idea, thanks.
 
If I'm being ignorant here, feel free to chime in anyone but here's my suggestion:

I don't have a way to try out but this might work for you, you'll probably have to tweak it a bit but I think it'd do the trick.
Criteria:
Between( (DateSerial(Year(Date()),Month(Date()),1) And <=Date()-1) And (DateSerial(Year(Date())-1,Month(Date()),1) And <=Date()-366))

If this wasn't what you were asking, I apologize! Good luck :)
 
Last edited:
Ok tried it but its throwing an error as follows:

You did not enter the keyword And in the Between...And operator.
The correct syntax is as follows:
expression [Not] Between value 1 And value 2

Any idea?
 
Ok tried it but its throwing an error as follows:

You did not enter the keyword And in the Between...And operator.
The correct syntax is as follows:
expression [Not] Between value 1 And value 2

Any idea?

Value 1: DateSerial(Year(Date()),Month(Date()),1) And <=Date()-1
Value 2: DateSerial(Year(Date())-1,Month(Date()),1) And <=Date()-366

Hmmm... I don't see why that's the issue, it clearly had the And operator.

You could try:
Value 1: DateSerial(Year(Date()),Month(Date()),1)
Value 2: DateSerial(Year(Date())-1,Month(Date()),1)
(Value 2 subtracts 1 year from the date)
Or:
Value 1: <=Date()-1
Value 2: <=Date()-366

If none of those work, I apologize sincerely!
I don't want to waste you time, just figured they'd help as suggestions.
That's all the knowledge I have that may be able to help you! I hope it does, good luck!
 
Just thought about this a bit more and maybe an easier way would just be to look for the 12 most recent dates (still dony know how to do that!)
 
We were over complicating it!
Code:
Between Date() And Date() -366

Thanks for helping all the same.
 
We were over complicating it!
Code:
Between Date() And Date() -366

Thanks for helping all the same.

Lol over complicating things is the mistake I make 90% of the time! Glad you figured it out, good job.
 

Users who are viewing this thread

Back
Top Bottom