where clause - using mid and instr functions

C

chuck_kruelle

need some help with the following select stmt:

SELECT CIEmpDir.EmailAddress, CIEmpDir.WireTransferLimitCust
FROM CIEmpDir
WHERE (( (Mid(([CIEmpDir].[EmailAddress]), 1, (InStr(1, ([CIEmpDir].
[EmailAddress]), "@")) )) = "bobsmith"));

whats wrong?

i need to add "-1" to the instr function. i'm trying to extract the
name from email address.

any help would be appreciated
chuckcycles
 
K

KARL DEWEY

I missed somthing.
If you have e-mail (e-mail address removed) then what do you want to extract?
 
J

John Spencer

Why not just use the a like opeartor in the where clause

SELECT CIEmpDir.EmailAddress
, CIEmpDir.WireTransferLimitCust
FROM CIEmpDir
WHERE EmailAddress Like "bobsmith@*"

Of course, you could use something like the following, but it would not be
nearly as efficient.

LEFT([EmailAddress], Instr(1,[EmailAddress] & "@","@") -1 ) = "bobsmith"
--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 

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