Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filter/Display records

Status
Not open for further replies.

rich001

Programmer
Feb 24, 2006
9
0
0
US
I am trying to create a query that asks the user to input [SSN] if the [SSN] matches "Admin" or "Support" in the DutySection field display all records if not then only display the selected [SSN]. I don't remember how to enter an if then statement that will override the select query if a the other condition is met. Any suggestions?

SELECT Personnel.SSN, Personnel.LName, Personnel.FName, Personnel.MI, Personnel.Rank, Personnel.DutySection, Personnel.[Duty Phone], Personnel.Supervisor, Personnel.[Duty Title], Personnel.Shift, Personnel.[Authorize Purchase]
FROM Personnel
WHERE (((Personnel.SSN)=[What is your SSN]));
 
Something like this ?
...
WHERE Personnel.SSN=[What is your SSN]
OR (SELECT [Duty Title] FROM Personnel WHERE SSN=[What is your SSN]) In ('Admin','Support')

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
What I am trying to do is display all records if after entering the SSN the [DutySection] equals “Admin or “Support”
 
Oh, sorry.
...
WHERE Personnel.SSN=[What is your SSN]
OR (SELECT DutySection FROM Personnel WHERE SSN=[What is your SSN]) In ('Admin','Support')

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
That is it thanks for the help. I have been trying this for a couple of days with no luck but it works like a champ now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top