J
Joe_Hunt via AccessMonster.com
I suspect I'll need to do this in VBA, but I've never programmed in VBA in
Access before, and it seems to be different than Excel. I have a rather
complicated worksheet in Excel that I'm trying to move into Access. I'm stuck
on one piece (I've spent a full day on it now) and I would appreciate any
guidance anyone could give. In Excel the formula looks at a column of dates
and compares it to the first of the month date entered by the user, usually
me, and performs one calculation if the date in the column is prior to the
date entered, and pulls a number from an Index if it's greater than or equal
to that date. The values in the "Index" change monthly. On the form I'm
setting up in Access apparently I can't create an index, and from what I've
been able to find out I'll need to use VBA with If-Then-Else statements. I
have tried over and over again with no success.
It's dificult to explain, but what I need is for what is in "Month Index 1"
to be in a current month textbox, "Month Index 2" in the next month, on down
to Month Index 36 if there's enough months in the probable life of the
vehicle. Next month Month Index 1 will be there, and Month Index 2 will move
down one month, etc.
I need this to look at an Option Button "Frame" with two buttons (2008 and
2009 selections, with option 2008 value of 1 and 2009 value of 2) and a model
year TextBox (2008 or 2009 will be displayed depending on other textboxes,
currently "MODEL_YEAR"), and the entered date (currently Text410). This
formula in a textBox works if it's prior to the date entered: IIF([Frame462]
=1 AND [MODEL_YEAR]="2008" AND [Text415]=1, [Text236]-[Text460], I just stuck
whatever in the else part to insure the other part worked). The textbox
numbers vary depending on which one the formula is going into.
With modification depending on the month (this would be April 1, 2009, and is
Month Index 2 since the date in cell B1 is March 1, 2009), If it helps the
Excel formula I've been using is: =IF($C$6="2008",IF(F26<B$1,G25-$I$5,IF
(F27>=B$1,(INDEX(C$11:C$46,DATEDIF(B$1-DAY(B$1)+1,F27-DAY(F27)+1,"m"))))),IF
(F26<B$1,G25-$I$5,IF(F27>=B$1,(INDEX(D$11$46,DATEDIF(B$1-DAY(B$1)+1,F27-DAY
(F27)+1,"m"))))))
I realize this is a little vague, but I hope someone can help me with this
somehow. I've been working on this form for way too long. Thank you.
Access before, and it seems to be different than Excel. I have a rather
complicated worksheet in Excel that I'm trying to move into Access. I'm stuck
on one piece (I've spent a full day on it now) and I would appreciate any
guidance anyone could give. In Excel the formula looks at a column of dates
and compares it to the first of the month date entered by the user, usually
me, and performs one calculation if the date in the column is prior to the
date entered, and pulls a number from an Index if it's greater than or equal
to that date. The values in the "Index" change monthly. On the form I'm
setting up in Access apparently I can't create an index, and from what I've
been able to find out I'll need to use VBA with If-Then-Else statements. I
have tried over and over again with no success.
It's dificult to explain, but what I need is for what is in "Month Index 1"
to be in a current month textbox, "Month Index 2" in the next month, on down
to Month Index 36 if there's enough months in the probable life of the
vehicle. Next month Month Index 1 will be there, and Month Index 2 will move
down one month, etc.
I need this to look at an Option Button "Frame" with two buttons (2008 and
2009 selections, with option 2008 value of 1 and 2009 value of 2) and a model
year TextBox (2008 or 2009 will be displayed depending on other textboxes,
currently "MODEL_YEAR"), and the entered date (currently Text410). This
formula in a textBox works if it's prior to the date entered: IIF([Frame462]
=1 AND [MODEL_YEAR]="2008" AND [Text415]=1, [Text236]-[Text460], I just stuck
whatever in the else part to insure the other part worked). The textbox
numbers vary depending on which one the formula is going into.
With modification depending on the month (this would be April 1, 2009, and is
Month Index 2 since the date in cell B1 is March 1, 2009), If it helps the
Excel formula I've been using is: =IF($C$6="2008",IF(F26<B$1,G25-$I$5,IF
(F27>=B$1,(INDEX(C$11:C$46,DATEDIF(B$1-DAY(B$1)+1,F27-DAY(F27)+1,"m"))))),IF
(F26<B$1,G25-$I$5,IF(F27>=B$1,(INDEX(D$11$46,DATEDIF(B$1-DAY(B$1)+1,F27-DAY
(F27)+1,"m"))))))
I realize this is a little vague, but I hope someone can help me with this
somehow. I've been working on this form for way too long. Thank you.