Query question

G

Guest

SELECT CandidateKeywords.Keyword, CandidateKeywords.CandidateID
FROM CandidateKeywords
WHERE [Enter a Keyword] Or ([Enter another] Or [Enter another] Or [Enter
another] Or [Enter another] Is Null);

This is the query I have created to enable the user to enter multiple
keywords to search on, however it only allows me to enter 2 keywords... and
no more... any help on this??

Many thanks in advance
 
T

tina

when i tested it the input box only popped up twice, as you said. but when i
changed the criteria to

[Enter a keyword]
[Enter a second]
[Enter a third]
[Enter a fourth]
[Enter a fifth]

all five popped up. apparently Access does not "read" the additional
criteria when the remaining prompts are identical to the second prompt.
btw, i could not get my test query to run with your syntax in the WHERE
clause, but if it works for you that's all that matters. :)

hth
 
D

David Ferguson

Change your query as noted below. Your problem was that you used 'Enter
another' four times in your query, so when entered for the first time,
Access assumed you would use the same criteria for the other three.


SELECT CandidateKeywords.Keyword, CandidateKeywords.CandidateID
FROM CandidateKeywords
WHERE [Enter a Keyword] Or ([Enter second] Or [Enter third] Or [Enter
fourth] Or [Enter fifth] Is Null);
 
G

Guest

Thanks Tina, that nows worked.... is there a possibility that I could add
something in there that if the user enters nothing, then the query finishes
and bases its query on information already provided. ie if the user only
wanted to enter 2 or maybe 3 keywords instead of the whole five?? I need to
the option to have five but sometimes would only need 2 or 3 to complete the
task at hand....

any help would be terrific thankyou.

tina said:
when i tested it the input box only popped up twice, as you said. but when i
changed the criteria to

[Enter a keyword]
[Enter a second]
[Enter a third]
[Enter a fourth]
[Enter a fifth]

all five popped up. apparently Access does not "read" the additional
criteria when the remaining prompts are identical to the second prompt.
btw, i could not get my test query to run with your syntax in the WHERE
clause, but if it works for you that's all that matters. :)

hth


Kerry said:
SELECT CandidateKeywords.Keyword, CandidateKeywords.CandidateID
FROM CandidateKeywords
WHERE [Enter a Keyword] Or ([Enter another] Or [Enter another] Or [Enter
another] Or [Enter another] Is Null);

This is the query I have created to enable the user to enter multiple
keywords to search on, however it only allows me to enter 2 keywords... and
no more... any help on this??

Many thanks in advance
 
G

Guest

This query works, but doesnt allow the user the just enter one or two,
instead of 5. I need the option of five and this now works, but sometimes it
is not always necessary.... is there another part to the query that i could
use to enable the user to enter 2 or 3 keywords, and if nothing was entered
in the third, then that query ends and conducts its search on just the 2
keywords that were entered?

kind regards

David Ferguson said:
Change your query as noted below. Your problem was that you used 'Enter
another' four times in your query, so when entered for the first time,
Access assumed you would use the same criteria for the other three.


SELECT CandidateKeywords.Keyword, CandidateKeywords.CandidateID
FROM CandidateKeywords
WHERE [Enter a Keyword] Or ([Enter second] Or [Enter third] Or [Enter
fourth] Or [Enter fifth] Is Null);




Kerry said:
SELECT CandidateKeywords.Keyword, CandidateKeywords.CandidateID
FROM CandidateKeywords
WHERE [Enter a Keyword] Or ([Enter another] Or [Enter another] Or [Enter
another] Or [Enter another] Is Null);

This is the query I have created to enable the user to enter multiple
keywords to search on, however it only allows me to enter 2 keywords... and
no more... any help on this??

Many thanks in advance
 
D

David Ferguson

Change your query to the following:

SELECT CandidateKeywords.Keyword, CandidateKeywords.CandidateID
FROM CandidateKeywords
WHERE (((CandidateKeywords.Keyword)=[Enter a Keyword] Or
(CandidateKeywords.Keyword)=[Enter second] Or
(CandidateKeywords.Keyword)=[Enter third] Or
(CandidateKeywords.Keyword)=[Enter fourth] Or
(CandidateKeywords.Keyword)=[Enter fifth]));

Enter the keywords you need and then leave the others blank (ie just hit
enter).




Kerry said:
This query works, but doesnt allow the user the just enter one or two,
instead of 5. I need the option of five and this now works, but sometimes it
is not always necessary.... is there another part to the query that i could
use to enable the user to enter 2 or 3 keywords, and if nothing was entered
in the third, then that query ends and conducts its search on just the 2
keywords that were entered?

kind regards

David Ferguson said:
Change your query as noted below. Your problem was that you used 'Enter
another' four times in your query, so when entered for the first time,
Access assumed you would use the same criteria for the other three.


SELECT CandidateKeywords.Keyword, CandidateKeywords.CandidateID
FROM CandidateKeywords
WHERE [Enter a Keyword] Or ([Enter second] Or [Enter third] Or [Enter
fourth] Or [Enter fifth] Is Null);




Kerry said:
SELECT CandidateKeywords.Keyword, CandidateKeywords.CandidateID
FROM CandidateKeywords
WHERE [Enter a Keyword] Or ([Enter another] Or [Enter another] Or [Enter
another] Or [Enter another] Is Null);

This is the query I have created to enable the user to enter multiple
keywords to search on, however it only allows me to enter 2
keywords...
and
no more... any help on this??

Many thanks in advance
 
G

Guest

ok thank you... the option of having 5 keywords definately works... I was
also hoping that if the user wanted to only enter just 2 that he/she wouldnt
have to keep pressing enter till the end of the 5 for the query to take
place. At least the query works now, which is what we needed. Thank you
David for all your help.

David Ferguson said:
Change your query to the following:

SELECT CandidateKeywords.Keyword, CandidateKeywords.CandidateID
FROM CandidateKeywords
WHERE (((CandidateKeywords.Keyword)=[Enter a Keyword] Or
(CandidateKeywords.Keyword)=[Enter second] Or
(CandidateKeywords.Keyword)=[Enter third] Or
(CandidateKeywords.Keyword)=[Enter fourth] Or
(CandidateKeywords.Keyword)=[Enter fifth]));

Enter the keywords you need and then leave the others blank (ie just hit
enter).




Kerry said:
This query works, but doesnt allow the user the just enter one or two,
instead of 5. I need the option of five and this now works, but sometimes it
is not always necessary.... is there another part to the query that i could
use to enable the user to enter 2 or 3 keywords, and if nothing was entered
in the third, then that query ends and conducts its search on just the 2
keywords that were entered?

kind regards

David Ferguson said:
Change your query as noted below. Your problem was that you used 'Enter
another' four times in your query, so when entered for the first time,
Access assumed you would use the same criteria for the other three.


SELECT CandidateKeywords.Keyword, CandidateKeywords.CandidateID
FROM CandidateKeywords
WHERE [Enter a Keyword] Or ([Enter second] Or [Enter third] Or [Enter
fourth] Or [Enter fifth] Is Null);




SELECT CandidateKeywords.Keyword, CandidateKeywords.CandidateID
FROM CandidateKeywords
WHERE [Enter a Keyword] Or ([Enter another] Or [Enter another] Or [Enter
another] Or [Enter another] Is Null);

This is the query I have created to enable the user to enter multiple
keywords to search on, however it only allows me to enter 2 keywords...
and
no more... any help on this??

Many thanks in advance
 

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

Similar Threads

multi keyword search 3
Match Criteria or display All Records 1
Another Query Modification Question 6
Keyword search in Access 1
Filter for years and keywords 6
Query trouble 4
Table Comparison 6
Access Query problem 1

Top