Isloaded on a SubForm

taileisin
taileisin used Ask the Experts™
on
I have 2 subforms within a main form, for shipping details both based on Zone Field in the main form, problem is some times not all zones in each, so the subforms may not load, i need to find if there are loaded to do a event on the loaded subform when next record button is clicked,
.Allforms(Form Name).Isloaded works with forms but not with the subform which is loaded within the Main Form like
[Forms]![MAIN]![subform]
When i use the just the subfrom name it does not work, and anyone help me
thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
Hmm, hard to understand your problem.
Looks like you have linked your two subforms to the mainform by the Zone field. This will imply that the siubform is loaded, but when not "match" is found for a zone, the subform remains blank....

You can detect this by checking from code or there are rows for a certain Zone, e.g. by testing with a
DLOOKUP("Zone","tblZone","ZoneID="&me.ZoneID)
When this is based on the rowsource of the subform a test for IsNull(dlookup(..,..,..)) will tell the Zone is missing...

Nic;o)

Author

Commented:
Thanks but it does not seem to work, cause the Subform2 is is linked by Zone and if the Zone does not exist Subform2 will not Load thus, it can not the value of Zone on Subform2, If IsLoaded would work with the subform2 name, i can solve it, but the IsLoaded function only seems to work with Forms, not with Subform open in a Form

Commented:
It will work, however in your case the form will always "tell" that it's loaded !
Access will show a message when the subform can't be loaded !

Just add a field on the mainform named txtIsLoaded

Now add in the mainform's OnCurrent event:
me.txtIsloaded = NZ(DLOOKUP("Zone", "tblZone","ZoneID="&me.ZoneID),"Empty")

And tell me the result.

Nic;o)

Author

Commented:
Sorry people used the OnCurrent Event to Run the Event on the Subform2

Thanks

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial