12/6/2021: I'm doing some work on the site this morning. If you notice anything crazy or not working, email me: amicron@gmail.com   [dismiss]
Access 2007-2019
Access 2000-2003
Access Seminars
TechHelp Support
Tips & Tricks
Access Forum
Course Index
Topic Glossary
Insider Circle
Home   Courses   Seminars   Templates   Help   TechHelp   Forums   Contact   Join   Order   Logon  
Home > TechHelp > Directory > Access > ByRef ByVal < For Next | Self Join >
ByRef v ByVal
By Richard Rost   Richard Rost on Twitter Richard Rost on LinkedIn Email Richard Rost   16 months ago

ByRef v ByVal in VBA. Creating an Increment Operator.

 S  M  L  XL  FS  Join Now

If you're familiar with languages like C there is an increment operator. To increase the value of X all you have to do is write X++ whereas in VB you have to say X=X+1. That doesn't seem like a lot of extra work, unless you have a long variable name like "CustomerStatementCounter" or something like that. So, wouldn't it be nice to create our own increment operator so all we have to say in our code is Inc X and that's it. That's what this lesson covers, and to do it, I'll teach you the different between ByRef and ByVal variable calls in our subs and functions. 

Alex from England (Admin) asks, "After watching yesterday’s Extended Cut video, you mentioned that Access VBA doesn’t have an Increment Operator like C does which is ++.  Does it support +="


I'll show you how to use optional parameters, use our increment sub with a form field instead of just a variable, determine if a value is numeric, and create a public global subroutine or function.

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 contact me so I can set up your account here on my web site. If you're not a member, Join Today!


Dim Variables: https://599cd.com/acd3
ByRef: https://599cd.com/byref
ByVal: https://599cd.com/byval
Create a Function: https://599cd.com/CreateFunction
Optional Parameters: https://599cd.com/acd1
Passing a Control as a Parameter: https://599cd.com/acd15
Variant: https://599cd.com/acd3
IsNumeric: https://599cd.com/acx25
Create a Global Module: : https://599cd.com/acd5

Learn More

FREE Access Beginner Level 1
Access Level 2 for $1.00

Free Templates

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


Mailing List - Get Emails When New Videos Released!
Consulting - Need Help with Your Database?


Please feel free to post your questions or comments below or submit them via the TechHelp page.


ByRef v ByVal Upload Images   Link  
Garry Smith 
10 months ago
Had time to watch some of your extended cuts, Thanks
It seems your tangents sometimes teach more than your original subject. I did appreciate the tangent on the
ByRef v ByVal video.
Richard Rost
10 months ago
Haha. Thanks Garry. :)
Add a Reply

Start a NEW Conversation
Only students may post right now. Click here for more information on how you can set up an account. If you are a student, please LOG ON first.

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

12/3/2021Access Beginner 2
12/3/2021Access Beginner 2 Lessons
12/3/2021Access Beginner 2
11/30/2021Import Multiline Cells
11/30/2021Adam's Access Games
11/29/2021Prevent Close
11/22/2021Currency Symbols
11/13/2021Access Developer 36

Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Account Login
Online Theater
Lost Password
Student Databases
Change Email
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Customer Support
Web Site Tour
Consulting Services
Affiliate Program
Richard Rost
Free Lessons
Mailing List
Video Tutorials
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Terms of Sale
Contact Info
Support Policy
Email Richard
Mailing Address
Phone Number
Fax Number
Course Survey
Blog RSS Feed    Twitter

YouTube Channel    LinkedIn
Keywords: TechHelp Access Increment Operator Pass by Reference Pass by Value ++ +=  PermaLink