943,621 Members | Top Members by Rank

Ad:
Apr 21st, 2009
0

Access Form Call Problem

Expand Post »
All,

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
or
        Form_frmMain![sfmMain].Form.ifmTABset![TabCtl0].Value = 5

        Form_frmMain![sfmMain].Form.ifmTABset![sfmUSR].SourceObject = "sfmSETcfg"
        Form_frmMain![sfmMain].Form.ifmTABset![sfmUSR].SetFocus
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.

Thanks!

TBN
Attached Thumbnails
Click image for larger version

Name:	ConfigScreen.jpg
Views:	14
Size:	90.4 KB
ID:	9898   Click image for larger version

Name:	ToolsScreen.jpg
Views:	12
Size:	57.7 KB
ID:	9899  
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
TBotNik is offline Offline
14 posts
since Jan 2009
May 25th, 2009
0

Re: Access Form Call Problem

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

Forms!frmMain.ifrmTABset.Pages(4).SetFocus

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

Forms!frmMain.page5.SetFocus

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
Reputation Points: 31
Solved Threads: 8
Junior Poster in Training
boblarson is offline Offline
77 posts
since Jan 2008
May 27th, 2009
0

Resolved

All,

Got this one fixed.

Thanks!

TBNK
Reputation Points: 10
Solved Threads: 0
Newbie Poster
TBotNik is offline Offline
14 posts
since Jan 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in MS Access and FileMaker Pro Forum Timeline: Union Query in ACCESS
Next Thread in MS Access and FileMaker Pro Forum Timeline: Help! Coding queris in vba for subforms





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC