Update month in 1 combo box based on input from another + a value

H

H J

I have 3 combo boxes on my form, CurrentMonth, NextMonth and Number. I want
the NextMonth box to update, based on the value that is in CurrentMonth +
the value (1 through 4) from the Number combobox.

So if I select January from CurrentMonth and 2 from Number, I want NextMonth
to display July.

The CurrentMonth and NextMonth combo boxes have 2 columns, the first shows
Jan, Feb, Mar etc and the second is the number for that month 1, 2, 3 etc
(second column is hidden).

Thanks.
 
D

Damon Heron

I am guessing you mean quarters rather than months.

combo1 should have a value list like this:
"1";"Jan";"2";"Feb";"3";"Mar";"4";"Apr"; etc.
and have a column count of 2
the second combo should have a value list:
1;2;3;4

in the afterupdate event of the second combo:

Private Sub Combo2_AfterUpdate()
Me.Text1 = DateAdd("q", CInt(Me.Combo2.Column(0)), DateSerial(Year(Date),
Me.Combo1.Column(0), 1))
'above all on one line
End Sub


No third combo needed - just a textbox to hold the date.

Damon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top