I have data fields with Name and Surname in format like "Name Surname". How
to write query which will return all fields where surname which is typed. I
tried this, but it doesn't work:
LIKE "*" & "[type surname]"
This will find all records ending with the literal text string [type surname]
which is certainly not what you want!
and also:
LIKE "*" & "[surname start with]*"
IF - and it's a bad idea, parameter queries are much better pulling from a
Form Control - you want to prompt for a name and find all cases where the
response occurs anywhere within the Surname field (e.g. the user types "DON"
and you want to find ""DONNEGAL", "ELDON", "LEDONNE"), use
LIKE "*" & [type surname] & "*"
To find only names starting with the prompt response,
LIKE [type surname] & "*"
Note - no quotes around the prompt, so it's seen by Access as a prompt rather
than as a literal text string.
--
John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also
http://www.utteraccess.com