PC Review


Reply
Thread Tools Rate Thread

cmb displayed item vs list

 
 
=?Utf-8?B?Qnl0aHN4LUFkZGFnaW8=?=
Guest
Posts: n/a
 
      27th May 2007
I wasn't sure how to phrase the subject line but what I am looking to do is
populate two list boxes (Start & End) with dates that become available after
refreshing a query. What I do not know how to do is setting the default
display of each combo box as specific days.

cmbStartdate should start with the last day of the month, 2 months ago
cmbEndDate should start with the last day of the month, 1 month ago.

All dates from the range should be available in both combo boxes, but to
save the user time I would like each box to start on those days mentioned.

Is this possible?
Thanks!!


 
Reply With Quote
 
 
 
 
Peter T
Guest
Posts: n/a
 
      27th May 2007
Your question is not clear at all. I assume the start and end dates you
refer to mean the dates the combo boxes should indicate when the form is
loaded, with actual start & end dates some time before and after these.

Anyway, following assumes end date is today, start date 10 weeks ago, and
the initial indicated dates are the last dates of each of the two preceding
months. I doubt that's what you really want but hopefully you can adapt to
your needs.

'in a userform with two ComboBox's named
' cmbStartdate & cmbEndDate

Private Sub UserForm_Initialize()
Dim d As Date
Dim dt0 As Date, dt1 As Date, dt2 As Date, dt3 As Date

dt3 = Date
dt0 = dt3 - 7 * 10
dt2 = dt3 - Day(dt3)
dt1 = dt2 - Day(dt2)

ReDim aDates(dt0 To dt3) As String

For d = dt0 To dt3
aDates(d) = Format(d, "dd-mmm-yy")
Next

cmbStartdate.List = aDates
cmbStartdate.ListIndex = dt1 - dt0
cmbEndDate.List = aDates
cmbEndDate.ListIndex = dt2 - dt0
End Sub

Regards,
Peter T

"Bythsx-Addagio" <(E-Mail Removed)> wrote in message
news:8374EF0C-4F80-4813-B715-(E-Mail Removed)...
> I wasn't sure how to phrase the subject line but what I am looking to do

is
> populate two list boxes (Start & End) with dates that become available

after
> refreshing a query. What I do not know how to do is setting the default
> display of each combo box as specific days.
>
> cmbStartdate should start with the last day of the month, 2 months ago
> cmbEndDate should start with the last day of the month, 1 month ago.
>
> All dates from the range should be available in both combo boxes, but to
> save the user time I would like each box to start on those days mentioned.
>
> Is this possible?
> Thanks!!
>
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
displayed item is selected item in list box MNJoe Microsoft Access Form Coding 3 23rd Apr 2008 07:11 PM
Highlighting the selected item in a combo box by making the item displayed in Bold characters. doyapore Microsoft Access 1 19th Jan 2005 02:49 PM
Sample code for macro to forward current displayed item to fixed recipients (dist list)? No Spam Microsoft Outlook VBA Programming 1 30th Nov 2003 04:13 AM
Item.Subject changed in NewInspector event is not displayed in item's Inspector Don Good Microsoft Outlook Form Programming 0 23rd Oct 2003 04:41 PM
Select item from dropdown list, item code is displayed in cell Meghan Microsoft Excel Misc 2 14th Oct 2003 08:46 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:42 PM.