Hopefully this will be easy for someone to answer!!
I have a form called "a" with 4 combos (well, more than that, but if I get the hang of 4, I can do the rest!):
"Property_Address1_Item"
"Property_Address2_Item"
"Property_Address3_Item"
"Property_Town_Item"
I have a table called "tbl_PropertyDetails" with the following fields:
"Property_Address1"
"Property_Address2"
"Property_Address3"
"Property_Town"
I have a query called "quy_SearchCriteria", with all the fields from the above table.
What I need is the form to be populated from the query, but the query to be populated from the form.
For example, if I selected "London" in the Town combo, the other combos will change to only list those properties with "London" in the Town field.
I have been trying with the following SQL:
I know it is not correct, but I can't see a way of doing it!
I probably need something else, but I can't think of anything!
I'm planning on having a reset button or something to clear the form so they can select a different search criteria.
Any help greatly appreciated.
Aubs
I have a form called "a" with 4 combos (well, more than that, but if I get the hang of 4, I can do the rest!):
"Property_Address1_Item"
"Property_Address2_Item"
"Property_Address3_Item"
"Property_Town_Item"
I have a table called "tbl_PropertyDetails" with the following fields:
"Property_Address1"
"Property_Address2"
"Property_Address3"
"Property_Town"
I have a query called "quy_SearchCriteria", with all the fields from the above table.
What I need is the form to be populated from the query, but the query to be populated from the form.
For example, if I selected "London" in the Town combo, the other combos will change to only list those properties with "London" in the Town field.
I have been trying with the following SQL:
Code:
SELECT tbl_PropertyDetails.Property_Address1, tbl_PropertyDetails.Property_Address2, tbl_PropertyDetails.Property_Address3, tbl_PropertyDetails.Property_Town
FROM tbl_PropertyDetails
WHERE (((tbl_PropertyDetails.Property_Address1)=IIf(IsNull([Forms]![a]![Property_Address1_Item]),[tbl_PropertyDetails].[Property_Address1],[Forms]![a]![Property_Address1_Item]))) OR
(((tbl_PropertyDetails.Property_Address2)=IIf(IsNull([Forms]![a]![Property_Address2_Item]),[tbl_PropertyDetails].[Property_Address2],[Forms]![a]![Property_Address2_Item]))) OR
(((tbl_PropertyDetails.Property_Address3)=IIf(IsNull([Forms]![a]![Property_Address3_Item]),[tbl_PropertyDetails].[Property_Address3],[Forms]![a]![Property_Address3_Item]))) OR
(((tbl_PropertyDetails.Property_Town)=IIf(IsNull([Forms]![a]![Property_Town_Item]),[tbl_PropertyDetails].[Property_Town],[Forms]![a]![Property_Town_Item])))
ORDER BY tbl_PropertyDetails.Property_Address1, tbl_PropertyDetails.Property_Address2, tbl_PropertyDetails.Property_Address3, tbl_PropertyDetails.Property_Town;
I know it is not correct, but I can't see a way of doing it!
I probably need something else, but I can't think of anything!
I'm planning on having a reset button or something to clear the form so they can select a different search criteria.
Any help greatly appreciated.
Aubs