[AccessD] simple piece of month-naming code

Drew Wutka DWUTKA at Marlow.com
Fri Jul 17 18:01:34 CDT 2009


No problem.  Just an FYI, Combos and Listboxes have the ability to fill
from a function.  (A Callback function).  If you create a basic module
(modListMonthNames) with a 'callback' function to populate with the
names of the month, like this:

Function ListMonthNames(ctrl As Control, id As Variant, _
row As Variant, col As Variant, code As Variant) As Variant
Select Case code
    Case acLBInitialize, acLBOpen, acLBGetColumnCount
        ListMonthNames = 1
    Case acLBGetColumnWidth, acLBGetFormat, acLBEnd
        ListMonthNames = -1
    Case acLBGetRowCount
        ListMonthNames = 12
    Case acLBGetValue
        ListMonthNames = MonthName(row + 1)
End Select
End Function

Then, throughout your project, whenever you want a listbox, or combobox,
that lists the 12 months, you just set the Row Source Type property (of
the combo or listbox) to ListMonthNames.  No coding required behind any
individual form then.

Drew (I know you said you didn't need any more help, but there might be
an article in setting up callback functions like this....)

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Susan Harkins
Sent: Friday, July 17, 2009 5:19 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] simple piece of month-naming code

I don't need anymore help, thank you very much. ;) 

Susan H. 


> LOL.  Yes, you did ask! ;)
> 
> Now, would you like to know how to do that with a combo/listbox
> function?  

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
The information contained in this transmission is intended only for the person or entity 
to which it is addressed and may contain II-VI Proprietary and/or II-VI Business 
Sensitive material. If you are not the intended recipient, please contact the sender 
immediately and destroy the material in its entirety, whether electronic or hard copy. 
You are notified that any review, retransmission, copying, disclosure, dissemination, 
or other use of, or taking of any action in reliance upon this information by persons 
or entities other than the intended recipient is prohibited.





More information about the AccessD mailing list