[英]Access Subform in a Subform I can not access to the field value
I have a problem regarding an Access Project.我有一个关于 Access 项目的问题。
Indeed, I have a subform sub2
within a subform sub1
which is in a main form main
.实际上,我在主窗体
main
的子窗体sub1
有一个子窗体sub2
。
In sub2
, I have a button that opens a new form created from a SQL query.在
sub2
,我有一个按钮可以打开一个从 SQL 查询创建的新表单。 This query is using in its "where" the value of a field of sub2
.此查询在其“where”中使用
sub2
字段的值。
The opening of the new form is good when I am only using sub2
.当我只使用
sub2
时,新表单的打开很好。
However, when I am doing the exact same thing through the main
form, sub2
requires me to enter a data instead of automatically opening the new form.但是,当我通过
main
窗体执行完全相同的操作时, sub2
要求我输入数据而不是自动打开新窗体。
My SQL query is SELECT Livres.*
FROM Livres
WHERE (((Livres.ID_livre)=[Formulaires]![Livre_sub]![ID_livre]));
我的 SQL 查询是
SELECT Livres.*
FROM Livres
WHERE (((Livres.ID_livre)=[Formulaires]![Livre_sub]![ID_livre]));
Livre_sub is sub2 ID_livre is the field value Livre_sub 是 sub2 ID_livre 是字段值
The query object has to reference through main form and 2 subform containers.查询对象必须通过主窗体和 2 个子窗体容器进行引用。 Something like:
就像是:
mainformname.subformcontainername.Form.subformcontainername!fieldname
Don't use dynamic parameterized query.不要使用动态参数化查询。 Use WHERE argument of OpenForm method.
使用 OpenForm 方法的 WHERE 参数。
DoCmd.OpenForm "formname", , , "ID_livre=" & Me.ID_livre
通用语法是:
[Forms]![NameOfMainForm]![NameOfSubform1CONTROL].[Form]![NameOfSubform2CONTROL].[Form]![NameOfControl]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.