I have a form with several fields. Two of them named Categoria and Familia.
Every Familia has one or more categoria.
I would like to show only the categoria for the selected familia.
So, I have this code to perform the selection:
SELECT Artigos.Categoria FROM Artigos WHERE (((Artigos.Familia)= [Familia]))
GROUP BY Artigos.Categoria;
It is not working. In this way it shows every categoria.
It woks if I specify the familia, like
SELECT Artigos.Categoria FROM Artigos WHERE (((Artigos.Familia)= “Livros”))
GROUP BY Artigos.Categoria;
Ofer Cohen - 03 Dec 2007 20:12 GMT
Look at this link on "Limit content of combo/list boxes"
http://www.mvps.org/access/forms/frm0028.htm
If you are using code, then you need to move the text box in the form out
side the string, like:
"SELECT Artigos.Categoria FROM Artigos WHERE (((Artigos.Familia)= " &
Me.[Familia] & ")) GROUP BY Artigos.Categoria"
Or, if you are filtering using the RowSource directly without code, you need
to provide the full path
SELECT Artigos.Categoria FROM Artigos WHERE (((Artigos.Familia)=
Forms![MainFormName]![Familia])) GROUP BY Artigos.Categoria

Signature
Good Luck
BS"D
> I have a form with several fields. Two of them named Categoria and Familia.
> Every Familia has one or more categoria.
[quoted text clipped - 7 lines]
> SELECT Artigos.Categoria FROM Artigos WHERE (((Artigos.Familia)= “Livros”))
> GROUP BY Artigos.Categoria;
Douglas J. Steele - 03 Dec 2007 20:16 GMT
SELECT Artigos.Categoria FROM Artigos
WHERE (((Artigos.Familia)= Forms![NameOfForm]![Familia]))
GROUP BY Artigos.Categoria;

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
>I have a form with several fields. Two of them named Categoria and Familia.
> Every Familia has one or more categoria.
[quoted text clipped - 9 lines]
> "Livros"))
> GROUP BY Artigos.Categoria;