?
Solved

date problem

Posted on 2003-03-30
1
Medium Priority
?
125 Views
Last Modified: 2010-05-01
there are 2 combo box

if combo1 select Jan then combo2 show 1 to 31 for choose

if combo1 select Feb then combo2 show 1 to 28 for choose

and so on...

how to do it?
0
Comment
Question by:Barca
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 14

Accepted Solution

by:
aelatik earned 80 total points
ID: 8234420
'Hi Barca,

'Place two combo's on your form and paste the following code...

Private Sub Combo1_Click()
    Combo2.Clear
For i = 1 To 31
    If IsDate(CStr(i & "/" & Combo1.ListIndex + 1 & "/" & Year(Now))) Then
        Combo2.AddItem i
    End If
Next
Combo2.ListIndex = 0
End Sub

Private Sub Form_Load()
Combo1.Clear
For i = 1 To 12
    Combo1.AddItem MonthName(i)
Next
Combo1.ListIndex = 0
End Sub
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question