Subform on Navigation form (1 Viewer)

Snowflake68

Registered User.
Local time
Today, 03:12
Joined
May 28, 2014
Messages
452
How do you reference a control on a subform within another subform that is on a Navigation tabbed form.

Main form = frmMain
Navigation form = DS
SubForm = sfrm_DS_ConvDetailSub
I can reference a control on the DS form with the following

Code:
[Forms]![frmMain]![NavigationSubform].[Form].[Controls]![DS].[Form].[Customer]
BUT
I now need to reference a control on the subform within the DS subform
I have tried the following but its not the correct syntax. Can someone help please.
Code:
[Forms]![frmMain]![NavigationSubform].[Form].[Controls]![DS].[Form].[sfrm_DS_ConvDetailSub].[Form].[Type1]
 

Snowflake68

Registered User.
Local time
Today, 03:12
Joined
May 28, 2014
Messages
452
I am still having issues with referencing the 3rd subform.

I have used many examples that I have found on different forums and website etc but still cant get it right.
Why is this so complicated?
Any help would be gratefully appreciated.
 

Minty

AWF VIP
Local time
Today, 03:12
Joined
Jul 26, 2013
Messages
10,368
The inbuilt navigation forms are horrible to work with, if the tab isn't the one in view then the form isn't actually loaded, so you can't refer to it. Is that your issue ?

If not try using the expression builder, it might get you there.
 

Snowflake68

Registered User.
Local time
Today, 03:12
Joined
May 28, 2014
Messages
452
Ive tried using the expression builder but once I get to the [DS] part of the syntax nothing comes up which references my subform.

I have the form loaded at the tab I am trying to reference so its not that but thank you for pointing it out because its not always obvious.
I have double and tripple checked the 'Name' of the form (on the Other tab in the properties) so its not that.
Im pulling my hair out with this one.
the subform that I am trying to refence on the DS subform is a datasheet so I hope that doesnt make any difference.
 

Snowflake68

Registered User.
Local time
Today, 03:12
Joined
May 28, 2014
Messages
452
I had made a mistake where the form was located. It was on a subform that was on another subform inside the the DS subform so an extra layer.

So this is what is was
Main
Navigation
DS
sfrm_DS_ConvDetailSub
frm_DS_ConvDetail I was trying to reference a control on there

However I have now moved the frm_DS_ConvDetail out of the subform called frm_DS_ConvDetailSub and placed it directly onto the for called DS

So I still need to find a way of referencing a subform within the DS subform but still cannot get the syntax correct.
Can anyone please help this is driving me insane.
 

Snowflake68

Registered User.
Local time
Today, 03:12
Joined
May 28, 2014
Messages
452

Thanks but it doesnt help with my senario unfortunately.

I am on the tab with the subform that I am trying to reference.
I can reference a control directly on the DS subform.
But I have a further subform(a datasheet) that is within the DS subform and this is where I am trying to reference a control.
This works for referencing a text box on the DS subform;
Code:
[Forms]![frmMain]![NavigationSubform].[Form].[Controls]![DS].[Form].[Customer]
But I want to reference a control on the datasheet subform that is on the DS subform. so I need to add the bit on the end that references a control called 'sfrm_DS_ConvDetailSub' and a combo box called cboOutgoingSize
 

Minty

AWF VIP
Local time
Today, 03:12
Joined
Jul 26, 2013
Messages
10,368
Try the immediate window as Galaxiom suggested in the other thread.

If not perhaps post up a stripped down version of your DB for someone to have a look at?
Only needs the forms and minimum dummy data for it to function ?
 

Snowflake68

Registered User.
Local time
Today, 03:12
Joined
May 28, 2014
Messages
452
Try the immediate window as Galaxiom suggested in the other thread.

If not perhaps post up a stripped down version of your DB for someone to have a look at?
Only needs the forms and minimum dummy data for it to function ?

Thanks Minty

It will take me a while to strip it down but I will try if I cant get the dam thing to work.
I may end up putting the code on the actual sub form and then just have a button that on the DS form that requerys the subform.
The buttons only hide and unhide columns depending on the number of columns selected from a control on the DS form. So if I put the code on the subform on load event I am hoping it will work as I only have to reference itself. Fingers crossed.
 

Minty

AWF VIP
Local time
Today, 03:12
Joined
Jul 26, 2013
Messages
10,368
Personally I'd ditch the Navigation form, they do make your life "interesting" and I think you can probably roll your own much better !
 

Snowflake68

Registered User.
Local time
Today, 03:12
Joined
May 28, 2014
Messages
452
How do I get the datasheet subform to reload within the DS subform?

I have code that hides and unhides columns but I cant get the changes to take affect unless I reload the whole form.

I have tried to .requery but this has no affect on the Datasheet. I have to click on the tab of the navigation to get the whole form to reload and then I can see my changes.
 

Snowflake68

Registered User.
Local time
Today, 03:12
Joined
May 28, 2014
Messages
452
Personally I'd ditch the Navigation form, they do make your life "interesting" and I think you can probably roll your own much better !
Ive invested too much time into the whole application to ditch it all now and dont really have the time to redesign it all. I am up against it tbh and need to get this working ASAP.:banghead:

Going to come back to it after I have been for a run
 

Minty

AWF VIP
Local time
Today, 03:12
Joined
Jul 26, 2013
Messages
10,368
How do I get the datasheet subform to reload within the DS subform?

I have code that hides and unhides columns but I cant get the changes to take affect unless I reload the whole form.

I have tried to .requery but this has no affect on the Datasheet. I have to click on the tab of the navigation to get the whole form to reload and then I can see my changes.

To get the whole form to reload try removing it from the subform container and then replacing it. It's quicker than you might think.

Code:
Me.YourSubFormContainer.SourceObject = ""
Me.YourSubFormContainer.SourceObject = "Whatever It was before you removed it"
 

Snowflake68

Registered User.
Local time
Today, 03:12
Joined
May 28, 2014
Messages
452
I dont think I am going to be able to requery the Datasheet subform unless I know how to reference it which is what the my original problem was. When I click on the tab at the top that reloads the whole form but there is no code behind the tab so I dont know how to code it to reload the whole form.
Back to square one after i have been for my run.
 

Snowflake68

Registered User.
Local time
Today, 03:12
Joined
May 28, 2014
Messages
452
To get the whole form to reload try removing it from the subform container and then replacing it. It's quicker than you might think.

Code:
Me.YourSubFormContainer.SourceObject = ""
Me.YourSubFormContainer.SourceObject = "Whatever It was before you removed it"

thanks but I still would need to know how to reference the datasheet subform from the DS subform in order to remove the source object from it and then put it back again.

Or do you mean from the DS subform?
 

Minty

AWF VIP
Local time
Today, 03:12
Joined
Jul 26, 2013
Messages
10,368
Yes do it from the parent form, no need to mess about with the form references then.
 

Snowflake68

Registered User.
Local time
Today, 03:12
Joined
May 28, 2014
Messages
452
Unfortunately it hasn't worked.
I tried the below and although I dont get any errors it does nothing to the Datasheet subform.
Code:
[Forms]![frmMain]![NavigationSubform].[Form].[Controls]![DS].SourceObject = ""
[Forms]![frmMain]![NavigationSubform].[Form].[Controls]![DS].SourceObject = "sfrmDS_Section_2"

I really think I need to know how to reference the subform.
Back to the drawing board :(
 

Minty

AWF VIP
Local time
Today, 03:12
Joined
Jul 26, 2013
Messages
10,368
Are your sub form CONTAINERS called the same as your forms?

I find it very helpful to rename them so that you know explicitly what you are referencing and changing.

Control Name :subcontFormName
Source Object : FormName

Just might help clarify things.

It won't help on the navigation form as it only has the subform control and replaces the form in it when you use the navigation tab controls.
 

Users who are viewing this thread

Top Bottom