IN THE SPOTLIGHT: MDE to MDB Conversion Service
(also supports: ACCDE to ACCDB, ADE to ADP, etc)
IN THE SPOTLIGHT: vbWatchdog
VBA error handling just got easier...
" vbWatchdog is off the chart. It solves a long standing problem of how to consolidate error handling into one global location and avoid repetitious code within applications. "
- Joe Anderson,
Microsoft Access MVP
Meet Shady, the vbWatchdog mascot watching over your VBA code →
(courtesy of Crystal Long, Microsoft Access MVP)
IN THE SPOTLIGHT: vbMAPI
An Outlook / MAPI code library for VBA, .NET and C# projects
Get emails out to your customers reliably, and without hassle, every single time.
Use vbMAPI alongside Microsoft Outlook to add professional emailing capabilities to your projects.
Provided by Allen Browne, June 2006
The ClearList() function deselects all items in a multi-select list box, or sets the value to Null if the list box is not multi-select.
The SelectAll() function selects all the items in a multi-select list box. It has no effect is the list box is not multi-select.
Use your own error logger, or copy the one in this link: LogError()
Function ClearList(lst As ListBox) As Boolean On Error GoTo Err_ClearList 'Purpose: Unselect all items in the listbox. 'Return: True if successful 'Author: Allen Browne. http://allenbrowne.com June, 2006. Dim varItem As Variant If lst.MultiSelect = 0 Then lst = Null Else For Each varItem In lst.ItemsSelected lst.Selected(varItem) = False Next End If ClearList = True Exit_ClearList: Exit Function Err_ClearList: Call LogError(Err.Number, Err.Description, "ClearList()") Resume Exit_ClearList End Function Public Function SelectAll(lst As ListBox) As Boolean On Error GoTo Err_Handler 'Purpose: Select all items in the multi-select list box. 'Return: True if successful 'Author: Allen Browne. http://allenbrowne.com June, 2006. Dim lngRow As Long If lst.MultiSelect Then For lngRow = 0 To lst.ListCount - 1 lst.Selected(lngRow) = True Next SelectAll = True End If Exit_Handler: Exit Function Err_Handler: Call LogError(Err.Number, Err.Description, "SelectAll()") Resume Exit_Handler End Function
|Home||Index of tips||Top|
This is a cached tutorial, reproduced with permission.
Have your say - comment on this article.
What did you think of 'ClearList() and SelectAll()'?
No comments yet.
Why not be the first to comment on this article?!
Have your say...