wildcards in query from form

  • Thread starter Thread starter John k.
  • Start date Start date
J

John k.

Hello,

i'm having trouble making a query that gives all the
records that match the criterea that a user can enter in a
form.
I have a form with 5 textboxes for user to enter
searchstrings in.
In my query im using wilcards to get al the records as
follows: ((boeken.trefwoord) Like "*" & ([Forms]!
[selecteren]![vaktrefwoord]) & "*") AND
((boeken.Plaatsingscode) Like "*" & ([Forms]![selecteren]!
[vakcode]) & "*"))
This works fine but I want to use OR instead of AND to get
all matches, but when i use OR the wildcards in the query
return all the records when a textfield in the form is
left empty.

Thanks for any help
 
WHERE
(([Forms]![selecteren]![vaktrefwoord] IS NOT NULL) AND
(boeken.trefwoord Like "*" & [Forms]![selecteren]![vaktrefwoord] & "*"))
OR
(([Forms]![selecteren]![vakcode] IS NOT NULL) AND
(boeken.Plaatsingscode Like "*" & [Forms]![selecteren]![vakcode] & "*"))

--
John Viescas, author
"Microsoft Office Access 2003 Inside Out"
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals"
http://www.viescas.com/
(Microsoft Access MVP since 1993)
 
Back
Top