locked
Staff Directory website - searching an Access database RRS feed

  • Question

  • Hi,  I am trying to put together a web based staff directory, with an MS Access backend.  The idea is that you simply type in a staff members name and it returns contact information.

     

    I followed this tutorial and it works beautifully

    http://expression.microsoft.com/en-us/dd571513

     

    But things are never that simple.  I have had a request to be able to search by more than just name, from the same search box.  So if someone types in Auckland - it returns all staff from the Auckland branch.  Searching by name still needs to work

    This is the original SQL query;

    SELECT DISTINCT [Name], [Business Phone] AS Business_Phone, [Mobile Phone] AS Mobile_Phone, [Job Title] AS Job_Title FROM [Staff Directory2] WHERE ([Name] LIKE '%' + ? + '%')

     

    Now, I want to search not only the Name column, but also Location, so I tried this

    SELECT DISTINCT [Name], [Business Phone] AS Business_Phone, [Mobile Phone] AS Mobile_Phone, [Job Title] AS Job_Title FROM [Staff Directory2] WHERE ([Name] LIKE '%' + ? + '%') OR ([Location] LIKE '%' + ? + '%')

     

    But it doesnt work.  Can anyone help?

     

    Thanks

     

    Sunday, October 16, 2011 10:45 PM

All replies