SELECT MainTable.ConferenceName, MainTable.MonthOfConference,
MainTable.YearOfConference, MainTable.PracticeArea, MainTable.Sponsorship,
MainTable.AdvertisementWhere, MainTable.Attend, MainTable.Speaking,
MainTable.Exhibit, MainTable.Attendee1First, MainTable.Attendee1Last,
MainTable.Attendee2First, MainTable.Attendee2Last, MainTable.Attendee3First,
MainTable.Attendee3Last, MainTable.Attendee4First, MainTable.Attendee4Last,
MainTable.Attendee5First, MainTable.Attendee5Last, MainTable.Attendee6First,
MainTable.Attendee6Last
FROM MainTable
WHERE (((MainTable.MonthOfConference) Like
[Forms]![SearchForm]![SearchFormMonth] & "*") AND
((MainTable.YearOfConference) Like [Forms]![SearchForm]![SearchFormYear] &
"*") AND ((MainTable.PracticeArea) Like
[Forms]![SearchForm]![SearchFormPracticeArea] & "*") AND
((MainTable.Sponsorship) Like [Forms]![SearchForm]![SearchFormSponsorship] &
"*") AND ((MainTable.AdvertisementWhere) Like
[Forms]![SearchForm]![SearchFormAdvertisement] & "*") AND ((MainTable.Attend)
Like [Forms]![SearchForm]![SearchFormExhibting] & "*") AND
((MainTable.Speaking) Like [Forms]![SearchForm]![SearchFormSpeaking] & "*")
AND ((MainTable.Exhibit) Like [Forms]![SearchForm]![SearchFormExhibting] &
"*"));
Everything works except the Sponsorship and Advertisement fields.
They are combo boxes on my search form, but so is the month and practice area.
KARL DEWEY said:
No clue.
Post your SQL. Open the query in design view. On the menu click on VIEW -
SQL View, highlight, copy and paste.
kdagostino said:
I really appreciate your help. For some reason when I type this into the
criteria and search under that category, it brings back ALL records
regardless of my search criteria. It work, however, in ignoring that box
when I don't type anything in.
for example: with-
Like [Forms]![YourForm]![YourTextBox] & "*" or Is Null
in the criteria for Sponsorship
I search for "Gold Level" Sponsorship, it brings back every record with or
without Gold Sponsorship. But if I search for "August" in the Month field,
with nothing in Sponsorship, it successfully returns only records in "August"
any ideas?
KARL DEWEY said:
Make it read --
Like [Forms]![YourForm]![YourTextBox] & "*" or Is Null
:
One more question:
There are two fields in which I haven't entered anything yet (I don't have
the data yet). They are Sponsorship and Advertisement.
When I put the criteria
Like Forms![SearchForm]![SearchFormSponsorshipLevel] & "*"
into the criteria in my query, nothing works. For example, I enter the
month of august and no records are returned
Is there anything I can do to have it ignore the criteria when there is
nothing there?
:
Use this for criteria --
Like [Forms]![YourForm]![YourTextBox] & "*"
:
I am trying to build a query for my database for conference attendence. I
have a search Form with the different criteria to type in such as Month,
Year, Department, Sponsorship, Advertisement, etc.
I want the query to recognize when I type in only the month and year, and
bring back those values, ignoring criteria for other other fields (e.g.
bringing back all records in August 2005, regardless of what department,
sponsorship, or advertisement). In otherwords, when I don't type anything in
a search field, I want the query to ignore that as a criteria.
Can anyone help me with this?