473,473 Members | 1,873 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Problem with Like operator in VBA

Hi All

A simple line of code , but it has had me thinking for a couple of
hours.

My brain hurts.......can anyone help

This works OK
If txtEMail Like "*@meredydd*" Then
Do this
End if:

But this doesn't
If txtEMail Like "*@meredydd*" XOR "*@jones*" Then
Do this
End if

Is it possible to do this on the same statement

Regards Bob

May 26 '06 #1
4 3250
If txtEmail Like "*@meredydd*" Xor txtEmail Like "*@jones*" Then

I'm not sure you really need Xor instead of Or in this context, as I don't
think a valid e-mail can't be like '*@meredydd*' and also like '*@jones*',
as that would mean that it contained two '@' symbols. I don't suppose it
will hurt anything, but it is probably redundant.

--
Brendan Reynolds
Access MVP

"bobdydd" <re**************@yahoo.co.uk> wrote in message
news:11*********************@i40g2000cwc.googlegro ups.com...
Hi All

A simple line of code , but it has had me thinking for a couple of
hours.

My brain hurts.......can anyone help

This works OK
If txtEMail Like "*@meredydd*" Then
Do this
End if:

But this doesn't
If txtEMail Like "*@meredydd*" XOR "*@jones*" Then
Do this
End if

Is it possible to do this on the same statement

Regards Bob

May 26 '06 #2
XOR is a bit wise operator and unlikely to be applicable as you are
using it (unless I have been missing something for a long time, which
is always possible); typically it's used in cryption and decryption.

Air code

If InStr(txtEmail, "@meredydd") <> 0 AND InStr(txtEmail, "@jones") <> 0
Then

May 26 '06 #3
Perhaps, I should have said bitwise. I was confused as I had been
thinking of George Bush who is Not a Bit Wise.

May 26 '06 #4
Thanks guys

I was getting in a pickle with that

Bob

May 26 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Emanuel Ziegler | last post by:
Hello, I want to do some mathematics with functions. In my case the function classes are very complex, but this simple example has the same problems. To allow calculations that begin with a...
0
by: Martin Magnusson | last post by:
I have defined a number of custom stream buffers with corresponding in and out streams for IO operations in my program, such as IO::output, IO::warning and IO::debug. Now, the debug stream should...
1
by: Tony Johansson | last post by:
Hello! I have some problem with template. I have two classes called Handle which is a template class and Integer which is not a template class. The Integer class is just a wrapper class for a...
3
by: Tony Johansson | last post by:
Hello! I have some problem with STL. I have two classes called Handle which is a template class and Integer which is not a template class. The Integer class is just a wrapper class for a...
24
by: Bangalore | last post by:
Hi all, I have a problem in accessing elements using overloaded operator . Consider, const int SIZE=10; int FALSE=0; class Array { private: int x; public:
10
by: toton | last post by:
Hi I have a class called Session, which stores a vector of Page, like vector<PageAlso each Page need's to know the Session to which it is attached. Thus I have, (the classes has many other...
4
by: daroman | last post by:
Hi Guys, i've problem with my small C++ programm. I've just small template class which represetns a array, everything works fine up to combination with std::string. I did tried it with M$ VC++ and...
13
by: Jeroen | last post by:
Hi all, I'm trying to implement a certain class but I have problems regarding the copy ctor. I'll try to explain this as good as possible and show what I tried thusfar. Because it's not about a...
1
by: david | last post by:
The code is located here: http://www.paste.lt/paste/fafbd9fbfc71e25f12458aacf61aca8f Before telling the problem I am now having and I would like to you that there is still a lot of mistakes,...
3
by: i3x171um | last post by:
To start off, I'm using GCC4. Specifically, the MingW (setjmp/longjmp) build of GCC 4.2.1 on Windows XP x64. I'm writing a class that abstracts a message, which can be either an integer (stored as...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.