By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,450 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

Combobox On A Custom Menubar

P: n/a
How do I create a combobox in a custom menubar to display months like:
1 January
2 February
3 March
etc

and then assign the month number (1, 2, 3, etc) of the selected month to a
textbox on a form?

Thanks for all help!

Judy

Nov 13 '05 #1
Share this Question
Share on Google+
10 Replies


P: n/a
Judy wrote:
How do I create a combobox in a custom menubar to display months like:
1 January
2 February
3 March
etc

and then assign the month number (1, 2, 3, etc) of the selected month to a
textbox on a form?


Create a table with those values and base the combobox on that table

--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea
Nov 13 '05 #2

P: n/a
But how do I create a combobox on a custom menubar? Then how do I get the
values in the table into the combobox and display the month name? Finally,
how do I assign the month number of the month selected to the textbox on a
form?

Judy
"Bas Cost Budde" <b.*********@heuvelqop.nl> wrote in message
news:co**********@news2.solcon.nl...
Judy wrote:
How do I create a combobox in a custom menubar to display months like:
1 January
2 February
3 March
etc

and then assign the month number (1, 2, 3, etc) of the selected month to a textbox on a form?


Create a table with those values and base the combobox on that table

--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea

Nov 13 '05 #3

P: n/a
"Judy" <jr*******@notmyemail.com> wrote in message
news:M%*****************@newsread2.news.atl.earthl ink.net...
But how do I create a combobox on a custom menubar? Then how do I get the
values in the table into the combobox and display the month name? Finally,
how do I assign the month number of the month selected to the textbox on a
form?


Sub AddComboToMenu()

Dim Mnu As Object
Dim Cbo As Object

Set Mnu = CommandBars("MyMenuBar")
Set Cbo = Mnu.Controls.Add(4, 1)

With Cbo
.AddItem "January", 1
.AddItem "February", 2
.AddItem "March", 3
.AddItem "April", 4
.AddItem "May", 5
.AddItem "June", 6
.AddItem "July", 7
.AddItem "August", 8
.AddItem "September", 9
.AddItem "October", 10
.AddItem "November", 11
.AddItem "December", 12
End With

Set Cbo = Nothing
Set Mnu = Nothing

End Sub

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 13 '05 #4

P: n/a
Judy wrote:
But how do I create a combobox on a custom menubar? Then how do I get the
values in the table into the combobox and display the month name? Finally,
how do I assign the month number of the month selected to the textbox on a
form?


Sorry, I didn't read the menubar part. I see Rick addresses this aptly.

Why do you want that to be on a menubar, not on the form? I immediately
confess I haven't got the slightest experience with manipulating menu
bars; I have the feeling you can attach a general function to, say, the
Click event (the name will be different). In that function you could
examine Screen.Activeform (possibly even .ActiveControl) to determine
where to store the value.

--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea
Nov 13 '05 #5

P: n/a
Rick,

Thank you for your response!

Where do I run the sub from? Does the combobox ever become permanent? Will
the combobox display just the month name? How do I assign the month number
of the selected month to a textbox on a form?

I am building a scheduling calendar form. To be readable, I made the
calendar take up the entire form. So I am creating a custom menu just for
that form to control the calendar.

Appreciate your help!

Judy

"Rick Brandt" <ri*********@hotmail.com> wrote in message
news:30*************@uni-berlin.de...
"Judy" <jr*******@notmyemail.com> wrote in message
news:M%*****************@newsread2.news.atl.earthl ink.net...
But how do I create a combobox on a custom menubar? Then how do I get the values in the table into the combobox and display the month name? Finally, how do I assign the month number of the month selected to the textbox on a form?


Sub AddComboToMenu()

Dim Mnu As Object
Dim Cbo As Object

Set Mnu = CommandBars("MyMenuBar")
Set Cbo = Mnu.Controls.Add(4, 1)

With Cbo
.AddItem "January", 1
.AddItem "February", 2
.AddItem "March", 3
.AddItem "April", 4
.AddItem "May", 5
.AddItem "June", 6
.AddItem "July", 7
.AddItem "August", 8
.AddItem "September", 9
.AddItem "October", 10
.AddItem "November", 11
.AddItem "December", 12
End With

Set Cbo = Nothing
Set Mnu = Nothing

End Sub

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com

Nov 13 '05 #6

P: n/a
Thanks for your responses!

See my reply to Rick.

Judy
"Bas Cost Budde" <b.*********@heuvelqop.nl> wrote in message
news:co**********@news2.solcon.nl...
Judy wrote:
But how do I create a combobox on a custom menubar? Then how do I get the values in the table into the combobox and display the month name? Finally, how do I assign the month number of the month selected to the textbox on a form?


Sorry, I didn't read the menubar part. I see Rick addresses this aptly.

Why do you want that to be on a menubar, not on the form? I immediately
confess I haven't got the slightest experience with manipulating menu
bars; I have the feeling you can attach a general function to, say, the
Click event (the name will be different). In that function you could
examine Screen.Activeform (possibly even .ActiveControl) to determine
where to store the value.

--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea

Nov 13 '05 #7

P: n/a
"Judy" <jr*******@notmyemail.com> wrote in message
news:rg****************@newsread3.news.atl.earthli nk.net...
Rick,

Thank you for your response!

Where do I run the sub from? Does the combobox ever become permanent?
Just place in a standard module and run it. Once run the MenuBar will have the
ComboBox and it will be permanent.
Will the combobox display just the month name? How do I assign the month
number
of the selected month to a textbox on a form?


The numeric argument in my code is the index for each entry. I suppose your
could have a function that would return that. Otherwise you would need to have
code that provided the desired numeric value when fed the name of the month and
use that.
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 13 '05 #8

P: n/a
Chuck,

Thanks for responding!

My calendar looks like a calendar and works just like a calendar allowing
the user to navigate to a selected year and month. For any selected year and
month, my calendar displays the courses scheduled for each day on the
calendar.

Judy
"Chuck Grimsby" <c.*******@worldnet.att.net.invalid> wrote in message
news:l8********************************@4ax.com...
On Sat, 27 Nov 2004 17:59:51 GMT, "Judy" <jr*******@notmyemail.com>
wrote:
I am building a scheduling calendar form. To be readable, I made the
calendar take up the entire form. So I am creating a custom menu just for
that form to control the calendar.


Save yourself a *LOT* of trouble, and take a look at Steven's Calendar
demo:
<http://www.lebans.com/monthcalendar.htm>
--
A Wise Shepherd Never Trusts His Flock To A Smiling Wolf

Nov 13 '05 #9

P: n/a
Chuck,

Thanks for the info. Now that I have more info about Steven's calendar, I'll
look into it more. I'm well underway on mine and hope to have it working in
a few days. I'll send you a copy when done.

Judy
"Chuck Grimsby" <c.*******@worldnet.att.net.invalid> wrote in message
news:ad********************************@4ax.com...

So does Steven's.

Take a serious look at it if you already haven't. I'd use it like
this:
Steven's form is what the user sees.
You can click on a date and have it populate a textbox on hidden
form, which causes Steven's calendar to disappear.
When the hidden form's date textbox changes (using the "On_change"
event, you open up another form, this one visible to the user, to
display all the data from the database that you want to display.

If you want the user to be able to select more then just a date, make
the form not a hidden form, but populated with whatever additional
selections you want or need to have (Locations, classes, instructors,
whatever).

Steven's calendar will also allow a user to select a range of dates,
so that you can program in something like "Find me a class within this
period." The only bug in it that I've been able to find is that the
user's range selection (highlighting a "group" of dates) is limited to
a single month. Other then that, it works like a charm!

But, it's your application. Do what you need to. I'd personally like
to see what you wind up with. I'm a bit of "nut" on calendars. I
have an application I run here on my personal computer that tells me
the date and what's happened on this date in about 25 different
calendars. It's just something I have for fun though...
On Sun, 28 Nov 2004 01:37:51 GMT, "Judy" <jr*******@notmyemail.com>
wrote:
My calendar looks like a calendar and works just like a calendar allowing
the user to navigate to a selected year and month. For any selected year andmonth, my calendar displays the courses scheduled for each day on the
calendar.

"Chuck Grimsby" <c.*******@worldnet.att.net.invalid> wrote in message
news:l8********************************@4ax.com.. .
On Sat, 27 Nov 2004 17:59:51 GMT, "Judy" <jr*******@notmyemail.com>
wrote:
>I am building a scheduling calendar form. To be readable, I made the
>calendar take up the entire form. So I am creating a custom menu just for >that form to control the calendar.

Save yourself a *LOT* of trouble, and take a look at Steven's Calendar
demo:
<http://www.lebans.com/monthcalendar.htm>

--
A Wise Monkey Never Monkies With Another Monkey's Monkey.

Nov 13 '05 #10

P: n/a
> Steven's calendar will also allow a user to select a range of dates,
so that you can program in something like "Find me a class within this
period." The only bug in it that I've been able to find is that the
user's range selection (highlighting a "group" of dates) is limited to
a single month. Other then that, it works like a charm!
Not a bug Chuck but an operator error!<grin>
The MonthCalendar class exposes a property to set the maximum number of
days allowed when selecting a range of dates. The default is 30. You can
set it to whatever you want!
:-)

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"Chuck Grimsby" <c.*******@worldnet.att.net.invalid> wrote in message
news:ad********************************@4ax.com...
So does Steven's.

Take a serious look at it if you already haven't. I'd use it like
this:
Steven's form is what the user sees.
You can click on a date and have it populate a textbox on hidden
form, which causes Steven's calendar to disappear.
When the hidden form's date textbox changes (using the "On_change"
event, you open up another form, this one visible to the user, to
display all the data from the database that you want to display.

If you want the user to be able to select more then just a date, make
the form not a hidden form, but populated with whatever additional
selections you want or need to have (Locations, classes, instructors,
whatever).

Steven's calendar will also allow a user to select a range of dates,
so that you can program in something like "Find me a class within this
period." The only bug in it that I've been able to find is that the
user's range selection (highlighting a "group" of dates) is limited to
a single month. Other then that, it works like a charm!

But, it's your application. Do what you need to. I'd personally like
to see what you wind up with. I'm a bit of "nut" on calendars. I
have an application I run here on my personal computer that tells me
the date and what's happened on this date in about 25 different
calendars. It's just something I have for fun though...
On Sun, 28 Nov 2004 01:37:51 GMT, "Judy" <jr*******@notmyemail.com>
wrote:
My calendar looks like a calendar and works just like a calendar allowingthe user to navigate to a selected year and month. For any selected year andmonth, my calendar displays the courses scheduled for each day on the
calendar.

"Chuck Grimsby" <c.*******@worldnet.att.net.invalid> wrote in message
news:l8********************************@4ax.com.. .
On Sat, 27 Nov 2004 17:59:51 GMT, "Judy" <jr*******@notmyemail.com>
wrote:
>I am building a scheduling calendar form. To be readable, I made the >calendar take up the entire form. So I am creating a custom menu just for >that form to control the calendar.

Save yourself a *LOT* of trouble, and take a look at Steven's Calendar demo:
<http://www.lebans.com/monthcalendar.htm>

--
A Wise Monkey Never Monkies With Another Monkey's Monkey.


Nov 13 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.