|
||||||
|
Count Characters By Richard Rost 4 years ago Count Specific Characters in a String with a For Next Loop 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?" MembersI'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 files from class plus get access to the Code Vault. If you're not a member, Join Today! UpdateWhile 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. LinksConcatenation: https://599cd.com/concatenation ExtrasAlex's Online Balance Braces Tool
|
||||||||||||||||||||||||||||
| |||
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 |