Public Sub ThereIsNo255ObjectLimit()
Dim lngLoop As Long
For lngLoop = 1 To 256
CreateForm
DoCmd.Close acForm, Forms(Forms.Count - 1).Name, acSaveYes
Next lngLoop
End Sub
To open another database in the UI ...
Private Sub Command0_Click()
Dim app As Access.Application
Set app = New Access.Application
app.OpenCurrentDatabase "C:\DSAPPS\db4.mdb"
app.Visible = True
End Sub
To open a form or report in a referenced MDB add a public function to the
referenced MDB (the one that contains the form or report) that returns an
instance of the required form or report, and call this function from the
referencing MDB ...
In db2.mdb ...
Public Function GetTheForm() As Form
Set GetTheForm = New Form_ExtForm
End Function
In db1.mdb ...
Private mfrmTest As Form
Private Sub Command0_Click()
Set mfrmTest = db2.GetTheForm()
mfrmTest.Visible = True
End Sub
Private Sub Form_Close()
Set mfrmTest = Nothing
End Sub
My advice is that you are trying to solve a problem that does not exist, or
at least does not have the cause that you think it has. Here are some
figures from one of our own applications, an application that has been in
daily use by multiple clients since the mid nineties ...
? currentdata.AllTables.Count
95
? currentdata.AllQueries.Count
193
? currentproject.AllForms.Count
82
? currentproject.AllModules.Count
93
? currentproject.AllReports.Count
59
? 95+193+82+93+59
522
Access 2000 had a marked tendency to corrupt *during development* when
working with large 'front-end' application MDBs (larger than approx 8MB, in
my experience). I'm referring here to corruption of forms, reports, and
code, as opposed to corruption of data, which is a separate issue. Access 97
did not have this problem, Access 2002 did not have this problem, and so
far, Access 2003 doesn't appear to have this problem. Which is not to say
that these other versions *never* corrupt, but it is rare. And even in
Access 2000, the problem was almost completely confined to development - it
is, in my experience, extremely rare for forms, reports, or code to become
corrupt in a production setting, when they are not being modified - as long
as you split the app and share only the data, not the application MDB,
across the network.
I promise you, if Access could not cope with more than 255 database objects,
we would not be having this conversation, because I would not be an Access
developer.