Have a set of nested forms/subforms in this order:

frmMain => sfmMain => ifmTABset => sfmUSR => sfmSETcfg

where sfmMain & sfmUSR are the control fields containing the subforms being called and the TAB control TabCtl0 resides in the TABBED form of ifmTABset.

I am trying to open the 5th TAB in the TABBED form and set it's subform with the following code:

Form_frmMain.sfmMain.Form![TabCtl0].Value = 5
        Form_frmMain![sfmMain].Form.ifmTABset![TabCtl0].Value = 5

        Form_frmMain![sfmMain].Form.ifmTABset![sfmUSR].SourceObject = "sfmSETcfg"

The last two lines are correct, but getting:

1. "not valid for this property",
2. "can't find field".

errors respectively. If I put the last two line first and I click the TAB after clearing the error the right subform shows.

The customer DB is designed with FE/BE config with central BE DB on the server, so writing an automated table relink subroutine. Have global of "LinkStat" initialized as False, with:

if LinkStat = true then
end if

in each "OnLoad" event for each screen, which is necessary as all forms are unbound, so have to execute for .rowsource of each combobox in each form in the onload for each.

When the link refresh runs, without error, the LinkStat is set True, but it is having trouble calling this config screen, on fail, where the user can "Browse" for the location of the BE file and sets it in a local table.

The config screen is in the fifth TAB of the TABBED form (which is the set of "SETUP" screens) and the 3rd subform in the SETUP Form, normally selected with button on lefthand side, see the ConfigScreen screen shot. The initial run always fails to link, so a manual call to the subroutine is needed, which is from the button in the Tools Screen (5th subform) per screen shot.

I know it is a syntax thing, but my mind is toast today, so please help. Just not seeing the obvious today.



Re: Access Form Call Problem 80 80

Tab controls are interesting in that you rarely need to do anything at all with them or reference them. In your case you need to set focus to tab 5 and then refer to the subform on subform. You have to set focus first. I will show you a way to refer to forms and controls which most don't use but with nested subforms it works well.

First the set focus


Since the pages are zero based, page 5 would be 4 in the scheme. You can also use just the page name instead of the tab control name. So if your page was actually named page5 then you would be able to go with


And then you need to refer to the subform item

Forms("frmMain").Controls("sfrmMain").Form.Controls("sfrmUser").SourceObject = "sfmSETcfg"

I think you may want to read my tutorial on subforms. It helps with understanding when to use the .Form. and when not to.
You can find it here:
Easy Way to Remember Subform Syntax

Re: Access Form Call Problem 80 80


Got this one fixed.



Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.