Julian,
 
    You wish the query to display either of the following alternative results, based upon selection made in a single combo box.
    (a) One particular Organization (GP Practice)
    (b) Other organizations (excluding GP Practice)
    (c) All organizations.
 
    Sample query given below will get you the desired results. T_Org is the name of table. CboGrp is the name of combo box on form F_Org. Row source Type for CboGrp is Value List, while its Row Source is the following string.
    "GP Practice";"Others";"ALL"   
    (The query is to be run only when the form is open.)
 
    Note - Whenever a query involves parameter input (whether through user prompt or reference to a form's control), it is considered a highly desirable practice  to incorporate a parameters clause at the beginning, with explicit declaration of data-type. It becomes all the more crucial in case of date type data.
 
    Sample db named QueryComboCriteria_2K.zip, demonstrating the above approach, has been uploaded to Files section of this group.
 
Best wishes,
A.D.Tejpal
--------------
 
====================================
PARAMETERS [Forms]![F_Org]![CboGrp] Text ( 255 );
SELECT T_Org.*  FROM T_Org
WHERE (((IIf([Type]="GP Practice","GP Practice","Others"))=[Forms]![F_Org]![CboGrp])) OR ((([Forms]![F_Org]![CboGrp])="ALL")) 
ORDER BY T_Org.Type;

====================================
 
----- Original Message -----
Sent: Sunday, August 14, 2005 14:52
Subject: [AccessDevelopers] Parameters for query

Hi All
This one has me pulling my hair out, not that there is much left

I have a combo box that currently looks up to a table of organisation types. This contains fields and values like
Org ID Type
1 GP Practice
2 Hospital
3 Area Health
4 Pharmacy
5 Council Office

etc

I want to have  combo box on a form so that a user can choose the organisation type which gets passed to a query and shows the contacts for a particular organisation type

BUT

I want to have it so that the user has 3 choices - 1: GP Practice, 2: Other Organisations (which encompasses all of the other organisations listed above) and 3: All Organisations (which is all of the organisation types)

I have tried various combo boxes to get this to work but no luck

Can anyone suggest how I do this please?

TIA

Julian F



Please zip all files prior to uploading to Files section.




YAHOO! GROUPS LINKS




Reply via email to