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 > Courses > Access > Developer > D25 > < D24 | D26 >
Access Developer 25

ByRef, ByVal, ActiveForm, Control, Product Groups

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


In this class I cover the ByRef and ByVal keywords for passing values to subs and functions. I'll teach you how you can use ByRef to have a function return multiple values from a function. We'll learn about ActiveForm and ActiveControl so that you can see which form and which field are currently active allowing you to change its value. We'll add product groups to our invoicing system. We built an invoicing system back in Developer 23. In this level we're going to add product groups so you can group stuff together in packages so instead of adding 10 line items every time someone wants to buy one of your bundles you just pick it once and then BOOM! all that goes right up into the order.


Topics Covered

In Lesson 1, we're going to learn the difference between passing values ByRef or ByVal to your subs and functions. We're going to build an increment subroutine where we send it a variable X and have it increment by one.

In Lesson 2, we are continuing with ByRef or ByVal. We're going to send some optional parameters to our function so you can say "I want to increment by 7 or ten instead of just one." I'll show you how to use it with form controls so you can put a field on a form and use your subroutine with that. Then we'll determine if it's a field or a number that we're working with and then of course we'll talk about public subroutines and functions which we have covered in previous classes so this would be a good review.

In Lesson 3, we're continuing with ByRef or ByVal. We're going to learn how to use ByRef to have a function return multiple values. Up until now functions have always returned one value: a boolean, a string, or whatever. In this lesson, I'm going to show you how to have a function return multiple values. We're going to return a status code. We're going to return whether or not a ticket is valid. That's the true/false. Then we'll return a status code, like the first character is not a "T" or whatever our validation rule happens to be. Then we'll also return a third value. We'll look up the customer's name and return that too. This is really cool stuff!

In Lesson 4, we're going to learn about the ActiveForm and the ActiveControl. We're going to learn how to determine what form and what control the user is currently on so we don't have to send it as a parameter to a function. Then we'll learn how to access the previous control so if you want to use a button, say you want to click on a field and then hit multiply by 10, the button can then figure out where the user came from. What was the previous control you were on? tThen instead of sending the name of the control we're going to actually dim a control itself as an object variable and learn how to work with different control types.

In Lesson 5, we're going to build product groups. What's a product group? Well if you sell products that you want to bundle together and put a package together then you can create a product group. Now, when you go to put an order in instead of having to say "I want this part this part, this part, this part," and manually pick them all, you just pick the product group. Then in the next lesson, lesson 6, we'll click one button and it will automatically add the group and put all the line items in for you.

In Lesson 6, we're going to take the product groups that we built in lesson five we're going to add a combo box under our order form so you could pick a product group. It will add the product group up top into the order using a Recordset loop. Of course we're going to then go to the invoice. We're going to hide all the $0.00 items because you don't want to show zeros for all the items that are in the group.You just want to show the package price. We'll indent those products that are zeros in the package. We'll bold the package name and then - and you don't see it in the screenshot - but I also add some conditional formatting so those packages will show up in orange.

Enroll Today

Enroll now so that you can watch these lessons, learn with us, post questions, and more.


Please feel free to post your questions or comments below. Thanks.


Lesson 1 in Dev25 Upload Images   Link  
Graham Hendricks 
9 months ago
What are the more stuff? Product planner? Will you show more qty products on the same future date? Different customers order on the same future date different goods? What about the product qty level changes for that specific future date ? This will be real learning curve
Richard Rost
9 months ago
Hang in there, Graham. This page is just a placeholder. The new D25 lessons are coming very soon. The "more stuff" is in development. I'll share soon.
Ray White
9 months ago
The Order link goes to  Access Developer 24
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:

11/22/2021Currency Symbols
11/13/2021Access Developer 36
11/13/2021Access Developer 36 Lessons
11/13/2021Access Developer 36
11/13/2021Control Tip Text
11/11/2021Link to Excel
11/11/2021Read Write Excel Data
11/10/2021Moving Average

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: access developer 25 byval byref activeform active form activecontrol active control product groups packages bundles  Page Tag: whatsnew  PermaLink