wingforward
12-15-2009, 01:52 PM
I'm trying to parse an e-mail address in query (to filter out duplicate domain names for a one time debugging routine). My code is Mid(Email.Address, InStr(Email.Address, "@"), 100)
I'm getting an "Invalid procedure call" error. Why is that?
The InStr() part works on its own and the Mid() works if I sub in an arbitrary number.
MSAccessRookie
12-15-2009, 02:02 PM
I'm trying to parse an e-mail address in query (to filter out duplicate domain names for a one time debugging routine). My code is Mid(Email.Address, InStr(Email.Address, "@"), 100)
I'm getting an "Invalid procedure call" error. Why is that?
The InStr() part works on its own and the Mid() works if I sub in an arbitrary number.
Your Query (modified for my Table/Column names) works for me with one exception. I get a failure whenever the email address is Null. Is this a possibility in your case? If it is try the following:
IIf(Email.Address Is Null, "", Mid(Email.Address, InStr(Email.Address, "@"), 100))
jdraw
12-15-2009, 03:38 PM
Your Query (modified for my Table/Column names) works for me with one exception. I get a failure whenever the email address is Null. Is this a possibility in your case? If it is try the following:
IIf(Email.Address Is Null, "", Mid(Email.Address, InStr(Email.Address, "@"), 100))
I think the Is Null code should be
IIf(IsNull(Email.Address), "", Mid(Email.Address, InStr(Email.Address, "@"), 100)
MSAccessRookie
12-16-2009, 07:02 AM
I think the Is Null code should be
IIf(IsNull(Email.Address), "", Mid(Email.Address, InStr(Email.Address, "@"), 100)
You are correct to a point, but I would like to point out that IsNull() is a VB Function, while IS NULL is an SQL Function. While either method will give the same results in this instance, I was presenting an SQL only solution.