Is there alternative for this code

Joe8915

Registered User.
Local time
Today, 14:38
Joined
Sep 9, 2002
Messages
820
The following is loaded in a query:

The field is called CS:
Like [Enter Specialist Last Name Only] & "*"

It works ok, but of course if you don't type anything it will bring all the records up for view, and I don't want that to happen. Can I do something that won't make that happen?
 
query

Joe

Like [Enter Specialist Last Name Only] & "*" will return whatever the user types in and the wild card bit will also return anything else after that.

eg. if you have a specialist named smith,one named smithers and one named smithy all three will be returned if you enter smith. If you dont enter anything effectively your asking the query to return all the records.

If you use [Enter Specialist Last Name Only] as your criteria entering smith will only return records with smith in that field. Of course if the name is spelt wrong on entry or no data is entered at the prompt no record will be returned.

hope this helps.

regards
Ian
 
One kind of cheap way around this is to use

Like nz([Enter Specialist Last Name Only], "XXYYZZ") & "*"

Sorry I don't have the abilty to test this at the moment, but the idea is that
if the user doesn't enter anything (null) then the search string will be XXYYZZ*, which should return no records.

Larry
 
Yep, that sure did it,

Dang I love this form. I learn so much here. its unreal
 
Well, I guess nothing is ever fool proof. If you type in someone else name, that is in qry, it will bring it up. The bottom line is I don't think I will ever get this to be as secure as I would like to have it.

I think I better just give up on this idea....................not in less??????????????
 

Users who are viewing this thread

Back
Top Bottom