Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   Seminars   Templates   TechHelp   Fast Tips   Forums   Help   Contact   Join   Order   Logon  
 
Glossary

New Entries Added Almost Daily!
Click here to get on our Mailing List

   

   Access    Excel    Word    Windows    HTML

 
MS Access

StrComp

Using the STRCOMP Function

In this tutorial you will learn how to use the StrComp Function.

The StrComp function returns an Integer indicating the result of a string comparison.

=StrComp( String1, String2, [Compare] )

String1 any valid string
String2 any valid string
Compare [Optional] the type of string comparison

In this example we will compare "Joe" with "joe".

StrComp - Function Engine

Since case is irrelevant then the result is 0.

The Settings are:

Compare
ConstantValueDescription
vbUseCompareOption-1Performs a comparison using the setting of the Option Compare statement.
vbBinaryCompare0Performs a binary comparison.
vbTextCompare1Performs a textual comparison.
vbDatabaseCompare2Performs a comparison based on information in your database. (Microsoft Office Access 2007 only.)

The Return Values:

Return Values
IfStrComp Returns
string1 is less than string2-1
string1 is equal to string20
string1 is greater than string21
string1 or string2 is NullNull

Alpha Numerically (Numbers < Letters) [See ASCII codes]

Query

The results using a Query would be

	SELECT STRCOMP("Joe", "joe") AS [MyComp]
	

FORM

In a Form you could set the Default Value of a Textbox to

	=STRCOMP("Joe", "joe")
	
VBA

In a Form add a TEXTBOX control and rename it "txtStrComp", then you could add the following in the Load Event.

	Private Sub Form_Load()
		txtSTRCOMP = STRCOMP("Joe", "joe")
	End Sub
	

Courses

Access 2013 Access Expert 25

Search

You can find more about this by searching the website.


Alex Hedley (Avatar) By: Alex Hedley


Click here to sign up for more FREE tips

 

You may want to read these articles from the 599CD News:

 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Email Richard
Mailing Address
Phone Number
Fax Number
Course Survey
Blog RSS Feed    Twitter

YouTube Channel    LinkedIn