NPO_Coder
NPO_Coder

Reputation: 97

Check if Access 2010 Navigation Subform is Open

I am developing a program to track client information that utilizes a navigation form as a main menu that is open at all times. Many of the subforms have list boxes that need to be requeried as data is entered/changed or the users tend to think that they haven't changed the recordset and we end up with duplicate data. I can't figure out how to check if a specific subform of the navigation form is open before I run a refresh... they are all referenced as 'NavigationSubform'. So, for example, if I add a new job placement for a client, I'd like to run a requery of this listbox in the 'onclose' event to make sure they have the newest info. I can do it... Forms!navMain!NavigationSubform.Form.lstEmployment.Requery ... but it bombs if the user has changed panes on the navigation form before closing the form. This happens a lot: for example, a client interrupts while you are entering Job Placement info and you stop and enter a counseling note before going back to it, leaving the main menu sitting in the 'Clinical' directory. Is there a way to check if a specific subform is loaded within the Navigation Subform object? I've attached a screen shot in the event it helps this make sense.

Thanks in advance for any suggestions!!

Employment Screen

Upvotes: 3

Views: 3414

Answers (2)

Fionnuala
Fionnuala

Reputation: 91376

You can check the contents of a subform control with the source object property, for example:

forms!mainform.asubformcontrol.sourceobject

You can also get the name of the form from the form object:

forms!mainform.asubformcontrol.form.name

Upvotes: 0

Brent
Brent

Reputation: 101

It has been a while but I believe you can use the isLoaded method to determine if a subform is loaded

http://msdn.microsoft.com/en-us/library/office/ff194656.aspx

hope this helps, Brent

Upvotes: 1

Related Questions