New database with subform will not stay open

rfear

Registered User.
Local time
Today, 02:20
Joined
Dec 15, 2004
Messages
83
The following code opens a database called "Design_Guide.mdb" from within another database i.e. it kicks off another independent access application.

This worked fine ( also works for excel and word etc ) until I used a subform in the form displayed at startup.

If I step through the code the database is opened but when the function ends the database disappears. The database operates normally if I open it in its own right from Windows, it also runs fine if I delete the subform.

The trouble is I want to use a subform. Does anybody know what's going on ?


Function Design_Guide()
Dim AccessFile As String
Dim AppAccess As Object
AccessFile = MasterRootDirectory & "\Design_Guide\Design_Guide.mdb"
Set AppAccess = GetObject(AccessFile)
AppAccess.Application.Visible = True
SendKeys "%( X)", False
End Function


DB1 -----) open design_guide ( no subform ) ----- works
DB1 -----) open design_guide ( with subform ) ----- disappears
 
Check the visible property of the subform if its set to no.
 
I checked the visible property and this was set to Yes, but that got me playing.

sbf Visible Property : Yes = Did Not Stay Open
sbf Visible Property : No = Stays Open ( but can't see subform )
sbf Enabled Property : Yes = Did Not Stay Open
sbf Enabled Property : No = Stays Open ( but can't scroll around subform )

So I got to thinking.

Now the database by default has the subform disabled ( enabled property set to no ). The database opens fine. In the auotexec macro for this 2nd database ( containing the subform ) I have a line of code that enables the subform whenever the database is opened.

Hey presto - everything works. The database opens, maximises to fill the screen and I can use the subform.

Not so sure this is the correct way of doing things, but it works.

Thanks for the lead.
 

Users who are viewing this thread

Back
Top Bottom