First Published 22 Aug 2024

I am grateful to fellow UK developer Neil Sargent, Smart IT, for alerting me to this bug.

Background:

It has been possible to use callback functions to populate comboboxes and listboxes in code for well over 20 years. The method was particularly useful before Access 2002 when the much simpler AddItem approach became available.

These days it is likely that relatively few developers still use this approach. Indeed, I had to remind myself how it worked when Neil first reported the bug.

Despite being a relatively niche feature, the approach does have several clear benefits. It makes for a 'lightweight' form with the listbox/combobox row source populated 'on the fly' as and when needed.



Description:
When using a call back function to populate a listbox, if you go from Form View to Design View and then back to Form View, Access crashes every time.
The issue has been confirmed by myself and 3 other current and former MVPs

Download:
Click to download the simple example database supplied by Neil Sargent:
      ListFill Example     ACCDB file     Approx 0.4 MB (zipped)

When the form is opened, the listbox is automatically populated by the ListFill callback function.
Change to design view then back to form view. Access will immediately crash.

Status:
The bug affects the latest Access 365 versions including Current Channel (version 2407) and Beta Channel (version 2409).
It has also been reported in version 2311 of Access 365. It does not affect Access 2010
I reported the bug to the Access team on Sunday 18 August

Workaround:
After changing a form with the callback function to design view, close the form before re-opening in form view.

Useful references:
      RowSourceType property (user-defined function) code argument values | Microsoft Learn
      Recipe 7.5 Programmatically Add Items to a List or Combo Box
      Callback functions in Microsoft Access VBA | Gustav Brock    Article 1 (of 3)



Feedback

Please use the contact form below to let me know whether you found this article interesting/useful or if you have any questions/comments.

Please also consider making a donation towards the costs of maintaining this website. Thank you



Colin Riddington           Mendip Data Systems                 Last Updated 22 Aug 2024



Return to Access Blog Page




Return to Top