Merlene,
Forgive me for the length of this response, but I will discuss a few things before I directly address the question--but these things are related....
Let's just go in order of appearance of my discussion points:
1. Using MonthName()
There is no need to use such a complicated formula to achieve what you want here. An alternate would be:
2. Naming Conventions for Controls
If you troll this forum enough, you will run across me ranting about proper naming convetions--particularly for controls on Forma nd Reports. When you list
Me.PreviousActionPlan1
, I don't know whether that is referring to the
Control that is named
PreviousActionPlan1 or the underliying
Field that is named
PreviousActionPlan1. This is because the default naming conventions (that MS Access assigns to all new drag-n-drop-from-the-field-list fields is the name of the
Field. This can cause some problems (as you continue developing in MS Access you will found out more about these problems), because that name is now
ambigous. Just like I can't say for certain what you are referring to, MS Access will have the same problems when figuring our what to do. So, renaming the
Control to something like
txtPreviousActionPlan1
, will make it not only clear to me that you want to set the control source of the
Control, but it will also be clear to MS Access (it does have a mind of its own, by the way).
This bit about naming conventions is a standard principle in our community, and I highly recommend you take it to heart and exercise the practice regularly.
3. What are you setting the Control Source to?
Indicates (from the code snippet provided), that you always want the Control Source to be "Test". I am sure that is not what you want, due to the nature of your question. However, in general, your code should work to assign a new Control Source. It is better--in circumstances like these--to have an "Unbound" Control, meaning that there is no Control Source assigned to that Control in the first place.
4. A more direct answer to your question.
I don't know exactly what the layout of your Form is, so part of this is a guess that you want to show the current quarter and the next three quarters? (Whenever folks are dealing with quarters, it's usually financial, and the either want to look at preceding or upcoming quarters. THe general principle behind a solutino to this has less to do with constantly changing the control source of a control than it does with modifying the query underlying the form to reflect the data you want to portray.
That's the theory, here's the practical. Instead of having an underlying record source with output fields of "2018-Q4", "2019-Q1", "2019-Q2", etc., which are constantly changing as you pass through the calendar year, I would suggest that what you want is a query with output fields of "Q1" (in which the Quarter of the Current date is in Q1--i.e., today is Q4 2018 according to your list, but for this purpose would eb Q1), "Q2", "Q3", etc., which are constant, but the quarter they represent changes as time passes through the calendar. Thus, the controls on your forms (and reports) can have "Q1", "Q2", etc. as a Control Source. This precludes the need to change things programmatically--which can be clumsy, and mostly unecessary.
So to do this, you need a formula in your query (again, I don't know what your data set looks like) that converts the date of any transactions to Q1-Q4.
It would be helpful to see your underlying query and we could probably work from there.