combo box date range

dark11984

Registered User.
Local time
Tomorrow, 08:12
Joined
Mar 3, 2008
Messages
129
Hi i'm trying to design a combo box to be used as a date picker.

On one form i have contract details with a contract start date(TxtBox1) and a contract finished date (TxtBox2).

On a second form i select the contract # from a combo box 1 (CboContract) then in combo box 2 (CboMonth) i want to select a month from the date range in TxtBox1 & TxtBox2.

So if Txtbox 1 = 01/01/2010 and TxtBox2 = 30/06/2010 then
CboMonth has values of:
Jan-2010
Feb-2010
Mar-2010
Apr-2010
May-2010
Jun-2010

Any idea how i could do this?

Thanks
 
Check out the sample here, I think you will find it a far more practical solution than trying to bash a Combo box into doing something it really wasn't designed for.
 
Thanks John, I ended up finding something i can use on another site. It wasn't what i originally wanted but it will do.

Code:
Private Sub Cbocontract_AfterUpdate()
 
Me.CboMth1.RowSourceType = "Value list"
M1 = Format(DateAdd("m", -5, Date), "MMMYY")
M2 = Format(DateAdd("m", -4, Date), "MMMYY")
M3 = Format(DateAdd("m", -3, Date), "MMMYY")
M4 = Format(DateAdd("m", -2, Date), "MMMYY")
M5 = Format(DateAdd("m", -1, Date), "MMMYY")
M6 = Format(Date, "MMMYY")
M7 = Format(DateAdd("m", 1, Date), "MMMYY")
M8 = Format(DateAdd("m", 2, Date), "MMMYY")
M9 = Format(DateAdd("m", 3, Date), "MMMYY")
M10 = Format(DateAdd("m", 4, Date), "MMMYY")
M11 = Format(DateAdd("m", 5, Date), "MMMYY")
M12 = Format(DateAdd("m", 6, Date), "MMMYY")
 
Me.CboMth1.RowSource = M1 & ";" & M2 & ";" & M3 & ";" & M4 & ";" & M5 & ";" & M6 & ";" & M7 & ";" & M8 _
& ";" & M9 & ";" & M10 & ";" & M11 & ";" & M12
End Sub
 

Users who are viewing this thread

Back
Top Bottom