How to refer to parameters in navigation forms in a query? (1 Viewer)

monfas

Registered User
Joined
Jun 18, 2012
Messages
32
Hi,

I did a query which parameter is written in a text box - tprj. This text box is in a form, which is in a navigation control, which is within another navigation control. How can I refer, in the query, to this text box?

The navigation forms are nmain which contains nprojects.
nmainsub and nconsultprojects are the navigation subforms
fprjconsult is a normal form, which is inside nconsultproject

I tried the following criteria:

[Forms]![Nmain].[form]![nmainsub].[form]![nprojects].[form]![nconsultprojects].[form]![fprjconsult].[form].[text4]

And

[Forms]![Nmain].[form]![nmainsub]![nprojects].[form]![nconsultprojects]![fprjconsult].[form].[text4]

And

[Forms]![nmainsub]![nconsultprojects]![fprjconsult].[form].[text4]

And

[Forms]![Nmain]![nmainsub]![nprojects]![nconsultprojects]![fprjconsult].[form].[text4]

And other forms too :banghead: but I can't get it right.


Does anyone have any idea on how to refer to forms inside navigation forms, inside navigation forms, in SQL? What are the rules for writing it clearly?
 

CJ_London

Super Moderator
Staff member
Joined
Feb 19, 2013
Messages
11,598
Have you tried using the query builder to navigate to the form you require?
 

monfas

Registered User
Joined
Jun 18, 2012
Messages
32
Yes, but the fprjconsult is refered in [forms]!f[fprjconsult].[text4], and this doens't work.
If I go through the "loaded forms" path, nothing appears under fprjconsult
 

CJ_London

Super Moderator
Staff member
Joined
Feb 19, 2013
Messages
11,598
You said
fprjconsult is a normal form, which is inside nconsultproject
so fprjconsult is not a normal form, it is a subform

You've also said that nconsultproject is a subform of Nmain.

Ensure all forms are open then use the expression builder to navigate to loaded forms, then navigate through Nmain,nconsultproject and fprjconsult and finally to Text4 which you then select by double clicking.

You should end up with something like

Forms![Nmain]![nconsultprojects].[form]![fprjconsult].[form]![text4]

If you are using tabbed forms available in 2007/10 then your starting point is the name of the form on the tab in which fprjconsult exists and not Nmain.

Note, for the query to work, the relevant form and specified path all need to be open and not in design view
 

monfas

Registered User
Joined
Jun 18, 2012
Messages
32
Still didn't manage to make it work, and tried in all possible ways I can devise.

[Forms]![nmain]![nmainsub]![nProjects]![naddproject].[Form]![Text4] and

[Forms]![nmain]![nmainsub].[form]![nProjects]![naddproject].[Form]![Text4]

When I have (only) the subform nprojects open, the expression comes out as (from the loaded forms) as [Forms]![nProjects]![naddproject].[Form]![Text4], but still asks me for the parameters if I start from the main form and if I start by loading the form nProjects, it will crash Access.... I'm a bit lost here. Not sure now if is a problem with the machine. Any suggestions? Thanks anyway for your previous sugestions.
 

monfas

Registered User
Joined
Jun 18, 2012
Messages
32
Ok, got it.

In the end is like this:

[Forms]![Nmain]![nmainsub].[Form]![naddproject].[Form]![prjid]

Being naddproject the subform in the nprojects navigation form, I thought this naddproject was just specific to another tab, but is obviously general to all tabs inside nprojects.


So in the end, the sintaxe must be something like this

[Forms]![Navigation main]![Navigation Main sub].[Form]![Navigation 2 Subform].[Form]![prjid]

So it only refers to the subforms of navigation tabs, and not to the client subforms.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom