Query by form – design view looks very odd

devans

New member
Local time
Today, 10:47
Joined
Apr 9, 2014
Messages
1
Hi Everyone,

I am quite new to Access so hope someone can help me out.

I have made a query which relies upon 3 drop down boxes and one text search box from a form.

It works, however, when I open up the query itself in design view it looks a little mad. Will this have any negative effect on its operation and is there any way to tidy this up?

I have attached a screenshot of the design view. The SQL view is:

SELECT Quotes.Title, Quotes.Author, Quotes.Office, Quotes.Category, Quotes.Date, Quotes.Quote
FROM Quotes
WHERE (((Quotes.Author)=[Forms]![frmSearch]![AuthorSearch]) AND ((Quotes.Office)=[Forms]![frmSearch]![OfficeSearch]) AND ((Quotes.Category)=[Forms]![frmSearch]![CategorySearch]) AND ((Quotes.Quote) Like "*" & [Forms]![frmSearch]![Quote Search] & "*")) OR (((Quotes.Office)=[Forms]![frmSearch]![OfficeSearch]) AND ((Quotes.Category)=[Forms]![frmSearch]![CategorySearch]) AND ((Quotes.Quote) Like "*" & [Forms]![frmSearch]![Quote Search] & "*") AND (([Forms]![frmSearch]![AuthorSearch]) Is Null)) OR (((Quotes.Author)=[Forms]![frmSearch]![AuthorSearch]) AND ((Quotes.Category)=[Forms]![frmSearch]![CategorySearch]) AND ((Quotes.Quote) Like "*" & [Forms]![frmSearch]![Quote Search] & "*") AND (([Forms]![frmSearch]![OfficeSearch]) Is Null)) OR (((Quotes.Category)=[Forms]![frmSearch]![CategorySearch]) AND ((Quotes.Quote) Like "*" & [Forms]![frmSearch]![Quote Search] & "*") AND (([Forms]![frmSearch]![AuthorSearch]) Is Null) AND (([Forms]![frmSearch]![OfficeSearch]) Is Null)) OR (((Quotes.Author)=[Forms]![frmSearch]![AuthorSearch]) AND ((Quotes.Office)=[Forms]![frmSearch]![OfficeSearch]) AND ((Quotes.Quote) Like "*" & [Forms]![frmSearch]![Quote Search] & "*") AND (([Forms]![frmSearch]![CategorySearch]) Is Null)) OR (((Quotes.Office)=[Forms]![frmSearch]![OfficeSearch]) AND ((Quotes.Quote) Like "*" & [Forms]![frmSearch]![Quote Search] & "*") AND (([Forms]![frmSearch]![AuthorSearch]) Is Null) AND (([Forms]![frmSearch]![CategorySearch]) Is Null)) OR (((Quotes.Author)=[Forms]![frmSearch]![AuthorSearch]) AND ((Quotes.Quote) Like "*" & [Forms]![frmSearch]![Quote Search] & "*") AND (([Forms]![frmSearch]![OfficeSearch]) Is Null) AND (([Forms]![frmSearch]![CategorySearch]) Is Null)) OR (((Quotes.Quote) Like "*" & [Forms]![frmSearch]![Quote Search] & "*") AND (([Forms]![frmSearch]![AuthorSearch]) Is Null) AND (([Forms]![frmSearch]![OfficeSearch]) Is Null) AND (([Forms]![frmSearch]![CategorySearch]) Is Null));


Thanks in advance for your help.

David
 

Attachments

  • Design View of Query.png
    Design View of Query.png
    32.1 KB · Views: 70
It is very hard to decipher your SQL, only you can do it. One baby step at a time.

Using brackets is very important. If you use ((A) Or (B) Or (C) And D) it will be messy like what you have, but if you'd use ((A Or B Or C) And D) will be a lot neater.
 
Try using Wildcards in all your Criteria.

Simon
 

Users who are viewing this thread

Back
Top Bottom