Try the attached file:
If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
Bob Fitzpatrick
hello dear Bob Fitz
thanks for replay but that is not what I wanted
Care to elaborate.
If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
Bob Fitzpatrick
when I filtered "David" only 35 age should be visible not all ages
So do you not want to filter the records on the form?
Why should only 35 be available?
What should be available in the other two combo boxes?
If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
Bob Fitzpatrick
Should save birthdate and calculate age.
You want cascading comboboxes? Each combobox should be dependent on the other 3?
RowSource for Combo1:
SELECT DISTINCT Table1.FirstName FROM Table1 WHERE (((Table1.LastName) Like "*" & Forms!form1!Combo2 & "*") And ((Table1.Country) Like "*" & Forms!form1!Combo2 & "*") And ((Table1.Age) Like Nz(Forms!form1!Combo4,"*")));
RowSource for Combo2:
SELECT DISTINCT Table1.LastName FROM Table1 WHERE (((Table1.FirstName) Like "*" & [Forms]![form1]![Combo1] & "*") AND ((Table1.Country) Like "*" & [Forms]![form1]![Combo2] & "*") AND ((Table1.Age) Like Nz([Forms]![form1]![Combo4],"*")));
RowSource for Combo3:
SELECT DISTINCT Table1.Country FROM Table1 WHERE (((Table1.LastName) Like "*" & [Forms]![form1]![Combo2] & "*") AND ((Table1.FirstName) Like "*" & [Forms]![form1]![Combo1] & "*") AND ((Table1.Age) Like Nz([Forms]![form1]![Combo4],"*")));
RowSource for Combo4:
SELECT DISTINCT Table1.Age FROM Table1 WHERE (((Table1.Country) Like Nz([Forms]![form1]![Combo3],"*")) AND ((Table1.LastName) Like "*" & [Forms]![form1]![Combo2] & "*") AND ((Table1.FirstName) Like "*" & [Forms]![form1]![Combo1] & "*"));
And if you want each combobox to have a null row, use UNION:
SELECT DISTINCT Table1.FirstName FROM Table1 WHERE (((Table1.LastName) Like "*" & Forms!form1!Combo2 & "*") And ((Table1.Country) Like "*" & Forms!form1!Combo2 & "*") And ((Table1.Age) Like Nz(Forms!form1!Combo4,"*")))
UNION SELECT Null FROM Table1;
Must use SQLView of query builder to build UNION statement.
Then put code in each combobox GotFocus event to Requery itself.
And probably want a command button with code to reset all comboboxes to Null.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
hello dear June7
Thanks for getting back . this is exactly what I wanted
I Appreciate you