Query Criteria Problem

S

Simon Harris

Hi All,

I have a form with text boxes that the user enters search criteria into.
They then hit the search button, which requeries my list box.

My listbox is driven from a query which has the following criteria in it (as
an example)

Like [Forms]![FRM_switchboard]![CustSurname] & "*"

This works Aok, I can enter 'smi' in the surname box, hit search and I get
all the smiths.

But, if I run a search with out entering anything in the surname box, I only
see records which have a surname recorded.

I think its to do with the way I set the wildcards up perhaps??

Hope someone can help!

Cheers!
Simon.

--
-
* Please reply to group for the benefit of all
* Found the answer to your own question? Post it!
* Get a useful reply to one of your posts?...post an answer to another one
* Search first, post later : http://www.google.co.uk/groups
* Want my email address? Ask me in a post...Cos2MuchSpamMakesUFat!
 
P

Pat Garard

I would expect this - where there is no name recorded, the value
will be NULL, and therefore not correspond to the string
condition '*'.

Try:
(Like [Forms]![FRM_switchboard]![CustSurname] & "*") Or IsNull
--
Hope this helps!

Pat Garard
Australia
apgarardATbigpondDOTnetDOTau

"One look is worth a thousand rumours."
Wen Hou, Warring States Period.

"Look twice!"
Pat Garard, 2003.
 
V

Van T. Dinh

Try changing your criteria to:

.... WHERE
([SurName] Like [Forms]![FRM_switchboard]![CustSurname] & "*")
OR
([Forms]![FRM_switchboard]![CustSurname] Is Null)

HTH
Van T. Dinh
MVP (Access)
 
S

Simon Harris

Many thanks for your replies guys - Works a treat now! :)

Kind regards,
Simon.
 

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


Top