mulitiple field query PLUS
I want to query an Access database through ASP. I want the query to return records based on parameters entered by the user, unless no parameter for a particular field is entered, in which case it would return all records where that field exists.
Example (and I hope this is clear):
The database is a list of documents of county records, containing a document name, a county name, a document summary, etc. I want the user to be able to look up records either by county, or document name, or both. So the query form will request the user to enter a parameter in the appropriate field. If they enter no parameter, the query is to assume all records containing any value for that field are being requested.
Some one suggested the statement below, but I get an
"Invalid use of vertical bars in expression" error.
Anyone know the correct Access syntax?
select * from records
where dName like '%' || nvl('&dName','') || '%'
and county like '%' || nvl('&county','') || '%';
Thanks for your help,