Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   Index   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > TechHelp > Directory > Access > Count Characters < NZ | ByRef ByVal >
Count Characters
By Richard Rost   Richard Rost on LinkedIn Email Richard Rost   4 years ago

Count Specific Characters in a String with a For Next Loop


 S  M  L  XL  FS  |  Slo  Reg  Fast  2x  |  Bookmark Join Now

In this Microsoft Access tutorial, I will teach you how to use a FOR NEXT statement in Microsoft Access VBA to count the number of time a specific character occurs in a string. We can use this to also count how many lines are in a long text field (textbox). 

Paul from Houston TX (Silver Member) asks, "I get emailed a (text) list of products every day. Next to each product is a + if that product is new. I need to know both of these counts to put in my daily report. Is there a way I can just copy and paste this text into Access and have it count the number of lines and the number of + it finds?"

Members

I'll show you how to create your own function. We will make CountChar into a function that returns a value. We will learn about Rich Text Fields and how to add color and HTML codes to your long text fields. We will learn how to count the number of open ( and close ) in a box and change the colors accordingly to allow you to see where they may not match up.

Silver Members and up get access to view Extended Cut videos, when available. Gold Members can download the database template from class plus get access to the Code Vault. If you signed up on YouTube you have to register on my YouTube Find User page so I can set up your account here on my web site. If you're not a member, Join Today!

Update

While the CountChar function that we create in this lesson works just fine and is a great teaching example, I have since discovered a faster, more efficient method for calculating these occurrences. See the updated, new and improved Count Occurrences video.

Links

Concatenation: https://599cd.com/concatenation
Enter Key Behavior: https://599cd.com/enter+key+behavior
New Line in Field: https://599cd.com/new+line+in+field
For Loops: https://599cd.com/acd3
Intro to VBA: https://599cd.com/IntroVBA
LEN Function: https://599cd.com/acd8
MID Function: https://599cd.com/acx25
While Loop: https://599cd.com/While
Create Functions: https://599cd.com/acd2
Create Public Module: https://599cd.com/acd11
Exit Function: https://599cd.com/exit+function
DoEvents: https://599cd.com/acd12
Rich Text Boxes: https://599cd.com/acx5
Arrays: https://599cd.com/arrays
Combo Box .Column: https://599cd.com/acd15

Extras

Alex's Online Balance Braces Tool

Learn More

FREE Access Beginner Level 1
FREE Access Quick Start in 30 Minutes
Access Level 2 for just $1

Free Templates

TechHelp Free Templates
Blank Template
Contact Management
Order Entry & Invoicing
More Access Templates

Resources

Mailing List - Get emails when new videos released
Consulting - Need help with your database
Tip Jar - Your tips are graciously accepted

Questions?

Please feel free to post your questions or comments below or post them in the Forums.

 

 

Comments for Count Characters
 
Age Subject From
2 yearsMistake in videoSandra Truax
2 yearsDim X as stringSandra Truax
4 yearsGlossary Chr and AscAlex Hedley

 

Start a NEW Conversation
 
Only students may post on this page. Click here for more information on how you can set up an account. If you are a student, please Log On first. Non-students may only post in the Visitor Forum.
 
Subscribe
Subscribe to Count Characters
Get notifications when this page is updated
 
 
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

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
PCResale.NET
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
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2024 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 4/23/2024 4:24:31 PM. PLT: 1s
Keywords: TechHelp Access count characters for next for loops count occurrences of a character in a string matching parentheses match brackets rich text html colors balance braces  PermaLink  Count Characters in Microsoft Access