you could create a table to hold the names of the forms and reports in the
database, manually adding/deleting records as appropriate - and base your
combo box RowSource on that table. or you could dynamically build a value
list for the RowSource, by looping through the AllForms and AllReports
collections of the CurrentProject object.
dynamically building the list would ensure that it's always up-to-date. but
if your database has subforms and/or subreports, they would also be included
in the list since they're objects in their own right, apart from their
"parent" objects. also, if you're following standard naming conventions in
your db, such as using "frm" and "rpt" prefixes and disallowing spaces and
special characters, then the dynamic list is going to be pretty ugly and
perhaps hard for your user to choose the correct form or report to open.
using a table has the drawback of needing to be updated each time a
form/report is created/deleted. on the other hand, you can decide what
objects to list, avoiding the problem of having subforms/subreports listed
separately. and you can include a field in the table for "nice" names for
the form/report objects, so the user doesn't see the actual object names.
personally, i would go with the table, as
tblObjects
ObjectName (primary key, the "real" name of the form/report in the database
window)
ObjectDisplay (the "nice" name to show the user in the combo box list)
ObjectType ("form" or "report")
in the form that has the combo box, add code to the combo box's AfterUpdate
event, that checks first to see if a name was selected from the list. if so,
then the code can check the ObjectType column of the RowSource, and run the
OpenForm or OpenReport command appropriately, referring to the ObjectName
column of the RowSource (should be the bound column) to get the name of the
object.
hth