find a word in the email address

  • Thread starter Rajesh Candamourty
  • Start date
R

Rajesh Candamourty

Dear All,

I have an email address say - [email protected]. while running a
code/query i want to gather all the emails with "@emberindustries.com"
seperately from the table - tableA. How do i do this?

Any help highly appreciated.
Thank you.
Raj.
 
R

Rajesh Candamourty

Thank you Rick.
but i have a situation different. in my code, the email id
[email protected] is stored in a string cont. now i want to check
using an if statement whether cont has the email id with
"@emberindustries.com" or not. so that based on this check i would call a
function.

Thanks in advance.
Raj
 
R

Rajesh Candamourty

Please help me, I am really tensed and nothing is working in my head right
now.
I tried -
If cont = "*" & "@emberindustries.com" Then
Call SenMailtoEmber
Else
Exit
End If
the condition does not get executed. Tell me where I am doing wrong.

Thanks.
Raj.
 
R

Rick B

you need to use "like" not "="

Rick B


Rajesh Candamourty said:
Please help me, I am really tensed and nothing is working in my head right
now.
I tried -
If cont = "*" & "@emberindustries.com" Then
Call SenMailtoEmber
Else
Exit
End If
the condition does not get executed. Tell me where I am doing wrong.

Thanks.
Raj.


running
 
R

Ronald W. Roberts

Rajesh said:
Please help me, I am really tensed and nothing is working in my head right
now.
I tried -
If cont = "*" & "@emberindustries.com" Then
Call SenMailtoEmber
Else
Exit
End If
the condition does not get executed. Tell me where I am doing wrong.

Thanks.
Raj.
Look at the InStr instruction in help.

This example uses the InStr function to return the position of the first
occurrence of one string within another.

Dim SearchString, SearchChar, MyPos
SearchString ="XXpXXpXXPXXP" ' String to search in.
SearchChar = "P" ' Search for "P".

' A textual comparison starting at position 4. Returns 6.
MyPos = Instr(4, SearchString, SearchChar, 1)

' A binary comparison starting at position 1. Returns 9.
MyPos = Instr(1, SearchString, SearchChar, 0)

' Comparison is binary by default (last argument is omitted).
MyPos = Instr(SearchString, SearchChar) ' Returns 9.

MyPos = Instr(1, SearchString, "W") ' Returns 0.

HTH
Ron
 
Top