vba - Dependent queries and referencing subform controls -


status

In my database there are many questions and a form, let's call them Query1a , Query1b , and Query2 , and Form1 .

Form1 control Text1 , ComboBox1 , and one button command1 .

Question 1A and 1B reference control on Form1 obviously, eg a SELECT Forms! Form1! Expr1 as text1 Question 2 depends on the query 1A and 1B.

Command1 run DoCmd.OpenQuery "Query2" click, and everything works fine.

The problem

I have many forms with the same structure as Form1 , and I want to put them all in one navigation tab. I create - & gt; Navigation - & gt; Drag the horizontal tab and form1 on any tab.

Now, when I try to use Form1 in the Navigation form, then I ask for the value of the pop up Text1 , Because query1a it

forms! Trying to look in Form1 , but my Text1 actually resides in form! NavigationForm! Form 1 Form .

Effort

I can change the code clearly in every question and refer to the subform, but it is tedious, not very elegant, and this navigation form Will break the ability to use the form outside.

Inspired by the comments, I also tried the following:

  1. a1 and Query1b
  2. Add parameter announcements to form1 in my button, I set parameters to program through QueryDef . In this way, I can do something like Dim qdf, such as DAO QQDf set qdf = CurrentDb.QueryDefs ("Query1a") qdf.Parameters ("Forms! Form 1! MyPerm"). Value = I! Text 1

    However, I do not know where to go from there, because for my queryDef object Query2 Is invisible.

    One thing that makes life easier, should be that the form object has been called from, to be able to refer to those questions, but I do not know that this is possible.

    This is ending with the parameter query, and with QueryDef query2 parameters. It works by commenting in @VBlades

    Because QueryDef objects access can see the parameters of queries on them, the query is located at the top of the query 2 GET_CUSTOMER; You can write code like this: query defaults ("query2"). Parameters ("customer_id") = 123, although not related to the ultimate top level, so the versatile of the underlying query can be reached at the higher level (at the top of my head), I do not know what happens if the pile of questions Have the same nominal parameters, I think they are all given the same value if the ultimate set is done) then yes, it can be done.

    In other words, I can pass any parameter to a query, it is also seen on the basis of all the questions. I do not know what happens if there is a name conflict.

    So I think my OP is a cheat, but it took me a while to understand ...

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -