Combo Box in Access 2003

Posted on 2011-04-20
Last Modified: 2012-05-11
Hi all.

I have a combo box in an Access 2003 form that lists: 1, 2, 3...12 (it represents each month of the year). When the end user selects a number, say 3 it will show the sales for March.

I want to be able to show in the Report title via a text box the month name (i.e. MARCH) instead of the number (3). How can I do this besides using IIF statements, is there a way to do this in the combo box?

Thank you in advance!
Question by:printmedia
    LVL 1

    Expert Comment

    Easy: in the report open event write some vba code that defines an array of strings say called months and load them with the months.

    dim months(12) as string
    Months(2)="February".. etc

     Then just insert months(variable) into you report title
    LVL 29

    Expert Comment

    by:Randy Downs
    Just click on properties of the combo box and change the names from 3 to 3 - March or whatever you like.
    LVL 119

    Accepted Solution

    place this codes in the Change or afterupdate event of the combo box

    private sub combo0_afterupdate()
    dim MonthName as string

    msgbox MonthName

    end sub

    you can use the string MonthName in your report
    LVL 1

    Expert Comment

    Assuming the combobox is two columns, column1 is the number and column2 is the month name, use combo0.column(1)

    Author Closing Comment

    I used a text box in the form to store the month name and referenced that in the report using your code.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    This isn't a frequent question on EE. I must have seen it three or four times (among several thousand questions). However, I use this trick quite often, most frequently as a delayed Current event. A form does not expose it's calculation dependenc…
    A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
    With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    760 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

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now