query

P

Paul

First off, thanks to Dan for helping me get this query
started. Secondly, I have a query which accepts a number
of parameters from the user to search for certain records.
Either, the user will enter a partial match for the
record, which seems to work fine or they can leave the
parameter empty and have it return all of the possible
records. It seems to work except for the date field. I
will post my SQL below and if someone could please help me
out that would be awesome. Thanks in advance!!
 
P

Paul

i forgot to post my SQL like I said I would. My bad =)

SELECT [Video Inspection Database].ID, [Video Inspection
Database].[Tape #], [Video Inspection Database].[Type of
Inspection], [Video Inspection Database].Company, [Video
Inspection Database].Location, [Video Inspection
Database].Date, [Video Inspection Database].[Report
Included], [Video Inspection Database].[Report #], [Video
Inspection Database].[Storage Box #], [Video Inspection
Database].[Long Description]
FROM [Video Inspection Database]
WHERE ( ( ([Video Inspection Database].[Type of
Inspection] ) Like "*" & [What type of Inspection is it?]
& "*" OR ("Type of Inspection" IS NULL) )
AND ( ( [Video Inspection Database].Company ) Like "*" &
[What company did the inspection?] & "*" OR ("Company" IS
NULL) )
AND ( ( [Video Inspection Database].Location ) Like "*" &
[Where did the inspection take place? (Amherstview, Odessa
or Bath)] & "*" OR ("Location" IS NULL) )
AND ( ( [Video Inspection Database].Date ) =[What year
was the inspection done?] OR ("Date" IS NULL) )
AND ( ( [Video Inspection Database].[Long Description] )
Like "*" & [What street are you looking for?] & "*" OR
("Long Description" IS NULL) ) ) ;
 
P

Paul

I seemed to have fixed the problem. I changed the Date
parameter line to:
AND (([Video Inspection Database].Date) Like [What year
was the inspection done?] & "*" OR ("Date" IS NULL))

Does this mean that if you have a parameter that have to
equal the record, then you cannot put the null after it??
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top