I have a database of plants (trees, shrubs, herbaceous perennials, etc) which I have planted in two gardens (Blackwithies and The Nook) originally developed using Access 2002. From time to time I have modified it to add features which I required and it has always worked perfectly with successive versions of Access.
After a hard drive failure I had to do a clean install of Windows 11 and all my apps. Fortunately I had a backup of my data. However, since the reinstallation all the Unbound Combo Boxes have stopped working giving the VBA error message ‘Can’t find project or library’. Other controls such as List Boxes and Option Buttons using macros continue to work perfectly.
There are three forms which contain Unbound Combo Boxes in which I can enter details of plants – PLANTS, PLANTS at BLACKWITHIES and PLANTS at THE NOOK – all based on a table named PLANTS. All the forms have fields for entering Genus, Species, Variety and Cultivar into the PLANTS table. There are also other fields from the PLANTS table which are not pertinent to this question. A query (FIND PLANT) combines the four fields mentioned above into a FullPlantName. It also has a hidden field which sorts the plants into alphabetical order. The FIND PLANT query is used as the Row Source in an Unbound Combo Box to select a plant to be displayed by the form. As the problem is common to all three forms I will describe its manifestation in the PLANTS form
The PLANTS form displays pictures of plants using an ActiveX control DBPics 2.0 downloaded from Ammara (see Figure 1). I use the FIND PLANT query in an Unbound
Combo Box (labelled FIND) to generate a list of plants in alphabetical order which I can scroll down to select the plant which I want the PLANTS form to display (see Figure 2).
However, when I click on a plant name I get the VBA window for the Form_PLANTS code with the error message,
Compile error:
Can’t find project or library
The VBA for the After Update [Event Procedure] for the Unbound Combo Box using the FIND PLANT query as the Row Source is:
Private Sub Combo249_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[ID] = " & Str(Me![Combo74])
Me.Bookmark = rs.Bookmark
End Sub
The ID is the key to PLANTS and is used in the FIND PLANT query to link the two together. When a failure occurs the first line is highlighted in yellow and the Str in blue (see Figure 3).
The Data for the Combo Box is shown in Figure 4.
I am not really conversant with Access VBA so I cannot work out what is wrong. Can anyone help? I would be most grateful.