In Calendar seminar we create the button +1 Month, is it possible to display the name of the month in a text box, label or similar?
Adam Schwanz
@Reply 6 months ago
You mean to figure out what month +1Month would move to?
Ewa GustafssonOP
@Reply 6 months ago
Yes, that's exactly what I mean. Because if I know what the next month is, I can also take the previous month. Attaches picture
Ewa GustafssonOP
@Reply 6 months ago
Adam Schwanz
@Reply 6 months ago
Something like this would give you last months name, the current month, and next months name. Just change the Date() field to the date field that sets your current month.
Can I use a Dropdown Box to select Current Month from and return the Previous Month and Next Month values ​​in the text boxes?
Ewa GustafssonOP
@Reply 6 months ago
(Don't know where this came from​​)
Can I use a Dropdown Box to select Current Month from and return the PreviousMonth and NextMonth values in textboxes
Adam Schwanz
@Reply 6 months ago
Sure, you should already have a date field somewhere though that sets up your calendar. That would probably be the easiest.
But if you want a combo box to select a month, you might need a little more vba to create a date field out of a combo box. The easiest way would probably be to store the month number inside the combo box along with the month name, so you wouldn't need to figure that out.
Ewa GustafssonOP
@Reply 6 months ago
Do you think that is too difficult for me to understand?
Sounds like a good idea to store the month number inside the combo box along with the month name.
But it sounds exciting with VBA programming.
Adam Schwanz
@Reply 6 months ago
No but I mean if you already have the date field, you could just automatically populate the previous and next months names onto the buttons and just put it into your current coding for +1Month etc. It's a lot simpler and streamlined.
If you want to do a combo box though, make it 2 columns, with a row source like this.. Bound column 1
1;"January";2;"February";3;"March";4;"April";5;"May";6;"June";7;"July";8;"August";9;"September";10;"October";11;"November";12;"December" You can set the width of the first column to 0 so you only see month names.
Then you can just do textboxes with control sources like
=IIf([MyCombo]=12,"January",MonthName([MyCombo]+1)) 'for next month
=IIf([MyCombo]=1,"December",MonthName([MyCombo]-1)) 'for prev month
Kevin Robertson
@Reply 6 months ago
I usually use a For Next Loop to add months to a Combo Box.
Dim X As Long, S As String
For X = 1 To 12
S = X & ";" & MonthName(X)
cboMonth.AddItem (S)
Next
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.
This thread is now CLOSED. If you wish to comment, start a NEW discussion in
Calendar Seminar Lessons.
The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.