Hello all,
This is part 2 of 3 posts, and lets go for the max points for all of them.
I need your help on a code that will change date for specific store number.
If we look at the image join to this post, we see in column 1 of the Flex Grid numbers that represent Store Numbers ex: 1530, 1531, 1535, 1536 and 1539.
In column 9, we have dates representing days of delivery.
Now what the code needs to do is that lest say that we have to move the delivery of the 10th of November because nobody is working, we need to move the date forward or backward depending on this logic.
For each stores, lets start with the first one 1530. He has a delivery date for Nov. 8, Nov 9, Nov. 10 and Nov. 12. but we need to change the date of the 10th.
So the code need to find when was the date that he had before the 10th and also find the next date after the 10th.
Before the 10th, it was the 9th. That was 1 day ago. But from the 10th to the 12th, it is 2 days later.
So since there more days after then before, it will change the date of the 10th to the 11th. And it will move on to the next store number 1531.
If the number of days would have been less after than before, it would of change the 10th to the 9th.
If it would have been equal, it would of change the 10th to 9th, I day before.
The date to cancel will be entered in a DTPicker1.
How can we do this please?
I know that its very hard, that's why I put extra points to this by splitting the post.
Thanks again
by: Brook1966Posted on 2009-11-09 at 05:38:55ID: 25775759
Your Ideal here is not difficult to do but confusing to understand "Exactly" what you want.
Let me re-state what I think you are saying so that I may help you better.
You wish to Locate the closest delivery date from a set of Company/Dates available.
You want to have a date picker to select the date and then find the appropriate record based on the given date so that.
A. Once you find and exact match, you want to return that store number/date or the row.
B. Return the same a option A for the row that has the path of least resistance ( which store will deliver sooner ).
Question:
1. What do you wish to do when multiple stores have the same delivery date.
2. What do you wish to do when multiple stores have the same number of days away from the requested delivery date. ( one store may have the 9th while yet another has the 11th for a requested date of the 10th ) OR ( two stores have the 9th for a requested date of the 10th )
Is all you want to accomplish is finding the correct row?
This sounds more like a homework assignment. :)