subforms switching source objects

R

Rob Bunocore

I've run into a very strange thing with my access forms and was
wondering if anyone had any idea what it was.

I have a form with two subforms. Just as an example, we can say
frmParent and frmSub1 and frmSub2. Even though I set each controls
SourceObject to be frmSub1 and frmSub2 resepctively, when I save and
open frmParent, I have frmSub1 as the SourceObject for both
controls.

I reset it to frmSub1 and frmSub2 again. Save the frmParent, open it
up and again it has switched to frmSub1 for both.

Anyone run into this before. I'm running Access 2003.

Robby
 
T

Tom Wickerath

Hi Robby,

Assuming that the SourceObject property is not being set in VBA code, then
it sounds to me like you may have a corrupt form. I would try deleting the
controls that hold both subforms, save the form and close it, and compact the
database. Then reopen the form in design view, add these two controls back
in, and set their SourceObject, and Link Parent/Link Child properties
appropriately.

If that does not work, you may need to import all objects into a new
database container. Create a brand new database and immediately disable the
NameAutocorrupt feature (see: http://allenbrowne.com/bug-03.html for reasons
why you want to do this). Then import all objects from the suspect database
into the new database, one group at a time. In other words, import all tables
(but not linked tables), then import all queries, then all forms, etc. While
Access will allow you to import all objects in one operation, the experts at
FMS, Inc. (a Microsoft Partner), have stated that it is best to import
objects one group at a time (Reference:
http://www.fmsinc.com/ubb/Forum12/HTML/000285.html).

Recreate any linked tables from scratch. Access can cache a lot of
information about linked tables, which may no longer be valid, so it's always
best to recreate the linked tables from scratch. When importing local tables,
make sure to check the option to import relationships, menus and toolbars,
and import/export specs. If any of the local tables in the source DB are
hidden, you'll need to first unhide them. You will need to set the checked
references to match the source database, along with any startup options set
under Tools > Startup. Going through this process often times solves
corruption problems, because you get a new set of the hidden system tables
(the tables whose names start with "MSYS"). These system tables are updated
appropriately as you import objects.

This may sound like a lot of work, but it really isn't. Creating a new
container DB, disabling NameAutocorrect, importing all objects one group at a
time, re-establishing any linked tables, setting startup options, and setting
references to match the source DB is usually a fairly quick procedure. When
you are in the Visual Basic Editor, in order to check that the references
match the source DB, you should do a Debug > Compile ProjectName as well.


Tom Wickerath
Microsoft Access MVP
https://mvp.support.microsoft.com/profile/Tom
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top