Conditional Select - parameter query

trober

New member
Local time
Today, 11:57
Joined
Aug 13, 2009
Messages
1
Hi, im trying to run a query in my database and i just cant seem to figure it out. To put things in perspective i work for a real estate company, and im trying to catalogue my new project leads (every possible building site i go to). Every site obviously has a location, or district in this case. Theres obviously a field for the district and i use a form that has a combobox which lets you select which district to view, amongst other things, and displays the list of possible leads. Right now my query looks for the combobox's value, and matches it with the district.id on the district table (its not linked to it though)


My problem that one of the possible districts to select is "not defined" (specially for rural zones where you cannot know for sure) so i need for the query to display all records when the controls value is 43.

Right now my query looks like this:

SELECT [01_Consulta_Principal].STA_NUM, [01_Consulta_Principal].NMB_TXT, [01_Consulta_Principal].NUM_Visita, [01_Consulta_Principal].NUM_Area, [01_Consulta_Principal].NUM_Precio_por_m2, [01_Consulta_Principal].NUM_Pisos, [01_Consulta_Principal].Num_Precio_Terreno, [01_Consulta_Principal].NUM_Corredor, [01_Consulta_Principal].NUM_Prioridad, [01_Consulta_Principal].NUM_DPTO, [01_Consulta_Principal].DST_NUM

FROM
01_Consulta_Principal

WHERE ((([01_Consulta_Principal].NUM_Prioridad)=[Forms]![06_Consulta_Terreno]![COMBO_PRIORIDAD]) AND (([01_Consulta_Principal].NUM_DPTO)=[Forms]![06_Consulta_Terreno]![COMBO_DPTO]) AND (([01_Consulta_Principal].DST_NUM)=[Forms]![06_Consulta_Terreno]![COMBO_DISTRITO]));

My problem lies with the statement in red letters. Basically i would need it to read something like Iff( Controlvalue = 43, Code for showing all, ControlValue)

Any help would be greatly appreciated.

thanks.
 

Users who are viewing this thread

Back
Top Bottom