I have a problem regarding an Access Project.
Indeed, I have a subform sub2
within a subform sub1
which is in a main form main
.
In sub2
, I have a button that opens a new form created from a SQL query. This query is using in its "where" the value of a field of sub2
.
The opening of the new form is good when I am only using 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.
My SQL query is SELECT Livres.*
FROM Livres
WHERE (((Livres.ID_livre)=[Formulaires]![Livre_sub]![ID_livre]));
Livre_sub is sub2 ID_livre is the field value
The query object has to reference through main form and 2 subform containers. Something like:
mainformname.subformcontainername.Form.subformcontainername!fieldname
Don't use dynamic parameterized query. Use WHERE argument of OpenForm method.
DoCmd.OpenForm "formname", , , "ID_livre=" & Me.ID_livre
通用语法是:
[Forms]![NameOfMainForm]![NameOfSubform1CONTROL].[Form]![NameOfSubform2CONTROL].[Form]![NameOfControl]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.