I'm a relative newbie to VBA and I am STUMPED.
I'm trying to use vba in MS Access to compare two fields to see if the
second string can be found somewhere in the first.
For example, I would like the statement to return true if:
StrOne = 00035A,00035B,2000,00103A
StrTwo = 00035B
Can anyone help?
Thanks in advance,
J 3 14813
Try the InStr function.
Jeff
"Weiler" <we********@hotmail.com> wrote in message
news:78**************************@posting.google.c om... I'm a relative newbie to VBA and I am STUMPED.
I'm trying to use vba in MS Access to compare two fields to see if the second string can be found somewhere in the first.
For example, I would like the statement to return true if:
StrOne = 00035A,00035B,2000,00103A StrTwo = 00035B
Can anyone help?
Thanks in advance,
J
Weiler wrote: For example, I would like the statement to return true if:
StrOne = 00035A,00035B,2000,00103A StrTwo = 00035B
Look up help on the instr function. For the above,
InStr(1,strOne, strTwo) = 8
If it's 0, strTwo isn't in there.
--
Tim - http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Want some?" - Ditto
Look up Instr() function in VBA Help.
Or, reconsider the data design - such repeating values should not be stored
in one field in a table. They should be stored in eg 4 records. Then VBA is
not needed - SQL will do the job.
Clive
"Weiler" <we********@hotmail.com> wrote in message
news:78**************************@posting.google.c om... I'm a relative newbie to VBA and I am STUMPED.
I'm trying to use vba in MS Access to compare two fields to see if the second string can be found somewhere in the first.
For example, I would like the statement to return true if:
StrOne = 00035A,00035B,2000,00103A StrTwo = 00035B
Can anyone help?
Thanks in advance,
J This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Megan |
last post by:
Hi everybody-
I'm helping a friend with a music database. She has an old one and is
creating a new one. She wants to compare records and fields in the old
database with records and fields in the...
|
by: Drew |
last post by:
Hello -
I am a converted VB programmer. What I am trying to do
it compare two strings in an if statement. The problem
is that when I use string.compare it always returns a
negative 1. I have...
|
by: David zhu |
last post by:
I've got different result when comparing two strings
using "==" and string.Compare().
The two strings seems to have same value "1202002" in
the quick watch, and both have the same length 7 which I...
|
by: Samuel R. Neff |
last post by:
Why would you cast two strings to objects to compare them? I saw code
in an MS sample on MSDN and don't get it.
if ( (object)name == (object)attr.name ) {
both "name" and "attr.name" are...
|
by: Roger Twomey |
last post by:
I have 16 string values that I need to compare to each other. No two are
supposed to hold the same value (if they do something is amiss and I need to
abort the operation).
Short of 'IF Then'...
|
by: Jason |
last post by:
Is there a mechanism in VB.NET that allows something like:
If myVar In ("A","B","C") Then...
The way I'm doing it now is:
Select Case myVar
Case "A","B","C"
Or like this:
|
by: balakrishnan.dinesh |
last post by:
hi frnds,
Im having two 20digit numbers, But while comparing those it
is giiving wrong ouput in javascript.
for example here is my code,
my secanrio is ,
~ If first 20 digit number is...
|
by: titan nyquist |
last post by:
I wish to compare two structs via == but it does not compile. I can
overload and create my own == but am I missing something that c#
already has implemented?
~titan
|
by: Peter Proost |
last post by:
Hi group, I want to compare path strings in order to sort them, assuming I
have got:
"a.txt"
"dir1\c.txt"
"e.txt"
"dir1\d.txt"
When I compare them using "e.text" would be greater than...
|
by: mcolson |
last post by:
I am trying to compare the last two values in the same column of a
table. First of all, I have a column titled Row_Index that uses an
index which starts at 1 and increments by 1. What I am trying...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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,...
|
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...
|
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...
| |