PDA

Click to See Complete Forum and Search --> : Entering Dates in Combo Boxes (2) ??


AndyCapp
Mar 28th, 2000, 05:34 AM
Hello,

First of all thanks to "bsmith" for getting me started. I have now got the dates reading into the combo box, but after each date in the list appear two characters that look like two bold |'s, (ie) 01 Jan II etc...

Is there any way I can get rid of these, to be able to just show the dates (ie) 01 Jan
Below is the code I am using and also my original problem:

Hope someone can help...
Thanks,
Andy............

Private Function PopulateDates(strForYear As String)

Dim dtStartDate As Date
Dim dtCurrentDate As Date
Dim strForYear2

dtStartDate = CDate("01/01/" & strForYear)
dtCurrentDate = dtStartDate
Do While strForYear = Format(dtCurrentDate, "yyyy")
Combo1.AddItem strForYear2 & Format(dtCurrentDate, "dd mmm ") & vbCrLf
dtCurrentDate = dtCurrentDate + 1
Loop
End Function

Private Sub Command1_Click()

PopulateDates (2000)

End Sub

Original Problem...
Is there any possible way that you can use an array or something like it to fill a list box with all the possible dates of the year, with just the date and month and not the year????

(ie) having it automatically display 1st January til 31st December...without the year being shown...????

Hope someone can help...
Thanks,
Andy............

Jamie One
Mar 28th, 2000, 02:30 PM
remove the "& vbCrLf" from the additem statement

I think

-Jamie One-

Jamie One
Mar 28th, 2000, 02:46 PM
Also you don't need the variable "strForYear2"

-Jamie One-