Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > TechHelp > Directory > Access > Custom MsgBox 3 < Custom MsgBox 2 | Custom MsgBox 4 >
Custom MsgBox 3
By Richard Rost   Richard Rost on LinkedIn Email Richard Rost   3 years ago

Custom MsgBox in Access. Part 3: Multiple Args


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

In this Microsoft Access tutorial series, we focus on creating a custom message box using VBA, enhancing the standard MsgBox function.

In Part 3, we will learn how to send multiple arguments to our form. We'll learn about name/value pairs. We're going to use the Split function to put our arguments into an Array to make them easier to parse.

Members

There is no extended cut, but here is the database download:

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!

Prerequisites

Links

Recommended Courses

Coming Up

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

Diamond Sponsors - Information on our Sponsors
Mailing List - Get emails when new videos released
Consulting - Need help with your database
Tip Jar - Your tips are graciously accepted
Merch Store - Get your swag here!

Questions?

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

KeywordsCustom MsgBox in Microsoft Access, Part 3

TechHelp Access 2016, Access 2019, Access 2021, Access 365, Microsoft Access, MS Access, MS Access Tutorial, #msaccess, #microsoftaccess, #help, #howto, #tutorial, #learn, #lesson, #training, #database, Custom Dynamic MsgBox, Custom MsgBox in Access, multiple arguments with openargs, name/value pairs, key/value pairs, split function, arrays, name value pairs, key value pairs

 

 

 

Comments for Custom MsgBox 3
 
Age Subject From
2 yearsPromptCaption NameValue1Rusty Abernathy

 

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 Custom MsgBox 3
Get notifications when this page is updated
 
Intro In this video, we continue building a custom message box in Microsoft Access by expanding on previous lessons and introducing advanced techniques for passing multiple parameters using name-value pairs. You'll see how to use the Split function and arrays to parse and handle data such as the prompt and title, set up a label for the prompt within the form, and structure your VBA code for flexible handling of arguments. This is part 3.
Transcript Today is part three of my custom message box series where we are building a bigger and better and better message box. Of course, since this is part three, make sure you go watch parts one and two before watching this one.

Also, we're going to get into some deep coding today. So make sure you watch my arrays video. We're going to be using arrays. Go watch my video on the split function. We're going to use the split function to take our list of arguments and split them into multiple pieces and put those multiple pieces into arrays - multiple arrays, actually. It's all going to be a lot of fun. Just go watch these videos and then come on back.

Alright, so in the last part - last lesson, we learned how to send data into the form using the open args, but that's only one bit of data. I need to send a bunch of different pieces of data for all the different things I want to change in this box: the background color, the prompt. We don't even have a prompt text box yet. Which buttons I want, what the caption is going to be, where the form should be positioned, all those different things.

So we're going to send them in name value pairs. You're probably familiar with name value pairs. We've worked with them before. First name equals Rick. Last name equals Ross. Phone equals, phone - come here, phone equals. These are name value pairs. Sometimes they're called key value pairs.

All we're going to do is stick them together and put a semicolon between them to delimit them. Then we're going to send this whole thing in as an open args string, which means you can't send anything in that's got a semicolon in it or an equal sign, for that matter. But these are parameters for your message box, so just don't do that.

Then we're going to take this whole thing and break it up into an array - actually into multiple arrays. The first array is going to have these individual elements in it. We're going to split it by the semicolon. So we're going to take that out of there, take that out of there. Now we've got an array with three elements in it.

Okay, and then inside each of those elements, we're then going to split it again on that equal sign. So that'll pop out, that'll pop out, and then that'll pop out. Now we'll have an array with three elements, and then inside those, we'll have arrays with two little elements in them.

Then we can take a look at it and say, okay, if this is the property - caption - set it equal to "hi there," and so on. You get the point. You see what I'm doing?

Alright, the first thing we need is to go into design view. We need a prompt box on here - a text box that's got some stuff in it. Now, I'm going to use a label instead of a text box because with a text box, when you click on it, the user can edit it. You get the little blinky cursor thing. I don't want that. I'm going to put a label here and that label will serve as our prompt area.

So, form design, grab a label. Always takes me a split second. I've been doing this for 30 years and I still get them confused. Drop a label like right about there wherever you want your prompt to go.

Alright, I'll just put the word "prompt" in there. Format it however you want it to look. We're going to make these options later, but for now, let's just make it dark blue and bold - not up, dark blue and let's go maybe 18 point. Alright, good size label.

And don't forget to give it a good name. We don't want to call it "label 18" the whole time. Let's just call it "prompt." It's not a reserved word. It's good enough.

Alright, let's save this and close it. Let's go back to our global module where our function resides. Last time we just sent "hi there," but I want to send the parameters in through the my message box function.

Alright, so the first thing, let's try to keep these lined up with the actual message box. Let's say the first thing is the prompt as a string, and the second thing is going to be the title that goes across. Now, if you remember with message box, if you don't specify a title, you just get "Microsoft Access." That's one of the things everyone always asks me, how do I get rid of that? Well, you put a title in there, but we're going to make it optional so the user doesn't have to type it in. They can be lazy and just use message box prompt like you always do.

We're going to say "optional title as a string." Now, you don't have to put equals empty string in there. If you don't, by default you get an equals empty string. So that's up to you.

Put a couple blank lines at the bottom. I hate working when it's on the very bottom of the window. It just bothers me for some reason. I always have to have blank lines at the bottom down here.

Okay, so we're getting two arguments in: prompt and title. We have to combine them into one thing to send to open args. So let's throw them both into our own variable - "args as string" and args equals - here's where we build our argument string - prompt equals whatever the user sends in the prompt variable and a semicolon.

Now, they may or may not send you a title. So I'll say if title is not blank, then args equals args - so add onto it - and title equals whatever is sent in the title and a semicolon on the end of it.

Alright, see how that works? Then what we'll do over here is we'll say open args equals - replace that with just args. Throw in a debug compile.

Now, this is why you want to throw a debug compile on every now and then. Take a look at what we got. The error message there explains it all: argument not optional. We require one of those two arguments to be sent. The prompt is required.

Same, prompt as string, title as string, being in brackets means it's not required.

So let's just put in here "Welcome Cadets" or whatever, that's our prompt, and then a title if you want across top, "Starfleet." Whatever you want to say, that'll be your title.

Now, before we do anything with the form, let's just take a peek at what we got. Let's go into here, right here, let's message box args just to make sure we're building our string properly. Regular message box is the developer's best friend, even if you play with something advanced like this. Or I like to use my status box thing a lot, but this is fine for now.

Alright, save it. Yes, let's go back out here, hit the button. So that's what our args string looks like: prompt="Welcome Cadets"; title="Starfleet Academy." Good enough.

Now we can get rid of that message box. That was just a test. Now when the form opens, it's now going to get that whole string. Now we have to parse that string. Here comes the tough part.

Let's go back to our form. Here's the form. Let's scrap this stuff that we got here. We're going to start over. Leave the move form stuff up there.

First, we're going to dim args as a variant this time. Why a variant? Because we're going to be putting the data into an array. So we're going to use a variant. Then we need a second array to hold each name value pair. So dim nameValue as another variant. We're going to split it again. And then we need a counter variable to loop through the first array. So dim x as long.

Now this time, instead of just putting me.openargs into the args string, we're going to say args = split using our split function, so I want you to watch that in the video. me.openargs, comma - what are we splitting it on? The semicolon.

So as it is right now, args is going to be an array. It's got two items in it. It's going to have the caption equals whatever and the prompt equals whatever. The title and the prompt.

Now we're going to loop through all the items in this array. You can't always rely on how many items you're going to have, so we're going to use LBound and UBound, the lower bound and upper bound limits, so we know where the array starts and where it ends. Sometimes it starts at zero, sometimes it starts at one. It depends.

This is the proper way to write this: for x = LBound(args) to UBound(args). So if your array goes from one to ten, it's going to go from one to ten. If it's zero to five, it'll go zero to five. Doesn't matter what those numbers are. That's how many items are in that array - how many elements are in the array.

I like to always finish my loop when I open a loop. I always like to put the end of it on the bottom. If it helps to visualize this stuff here, I'll put a little comment over here. Each element in this array is going to look like caption=hi there or whatever. That's one element in that.

Now we're going to take each of those args items and split it again into the name/value array. So nameValue = split. What are we splitting? We're splitting whatever element of the args array we're on, so args(x). The loop, x: one, number two, number three, and so on. For each element in that array, we're going to split it on the equal sign. Split it on that equal sign. That's going to give us two more elements, the caption and the hi there.

So again, each element in here is going to be caption, and then we're going to have "hi there" as a separate one. If you wanted to stay like that, this other one would be - what is it - prompt=whatever. So you'll have two different items. The first loop breaks those up. The second loop breaks up each one of these inside of it. So you got two separate elements here.

Now, we have to check in here - and this is a weird one, but sometimes it'll come up where you might get a first item without a second item. You'll get prompt=whatever. If you accidentally send an empty string or something in there. So we just want to make sure we've got both elements. I'm just going to do a quick check in here to make sure that the name value pair was properly split before we do anything else.

So if UBound(nameValue) = 1, in other words, you got a second item - it's zero and one.

Now, if we get in here, if we get to this point, now we've got nameValue(0) and nameValue(1), which is going to be the name and the value. Zero is the name, one is the value.

Now, you can either use if then, or you can do a select case, either one. I'm going to use select case because it's something else to teach if you're not too familiar with it.

Alright, so we're going to say select case nameValue(0). I want to look at whatever the first item is - the name. And I'm going to say case "title". If this happens to be the title, what am I doing? The title is going to be the caption of the form. So me.caption = nameValue(1).

NameValue(0) is the name, nameValue(1) is the value - title and the value.

Well, what if nameValue(0) is "prompt"? We're going to say prompt.caption - that's the label prompt, remember - equals nameValue(1). It's the same thing. Each time this loop goes, it's going to have a different item in it. They'll have a caption, and then it'll have the prompt or the title and then the prompt.

I always like to throw in a case else. This should never happen, but just in case, we'll throw up a regular message box and say "unknown name value."

Your end user is never going to interface with this function. This is completely for you, the developer. Your people aren't going to work with this. You - the programmer, the developer, the Access guru - are going to be the only one feeding this function data. So I'm not putting all the checks in here that I would always put in something that an end user could interface with. They're not going to set up custom message box in the database. You are. So make sure you feed it correctly and test it.

And select.

So if we did our work correctly, I should be able to send in the open arg string. The open arg string is going to be first split based on that semicolon. We got this in the args array, the elements of the args array. Then the args loop is going to go through those and it's going to break them up based on the equal sign, and I've got caption and hi there.

Now we should be able to see if it works. Let's save it. Always good to do a debug compile. Always throw a debug compile in there. Come back out here, close it, click the button.

And look at that. There we go. That nice? We sent to the function in here, right? In our button, let's go over here and take a look again in our main menu.

Main menu. We said myMessageBox "Welcome Cadets", "Starfleet Academy" is the title on the top. The myMessageBox function definition built the open args string: prompt equals that, title equals that. We sent that as an open args argument into the form.

Where's the form? There we are. The form then split that open args apart into its individual components.

Could we have done it with temp vars or global variables or a table even? I mean, yeah, there's a million ways to do this, but again, I'm teaching you different stuff. I'm teaching you different Legos. You can put them together however you want. This is good stuff to know. Working with arrays definitely is a good skill.

Now, you might not wrap your brain around this the first time you run through it. Run through it again. I guarantee you the second or third time you see all this put together - and we're going to do a lot more with this. We're going to add more stuff to it over the next couple of lessons - you'll get it. The light bulb is going to go on. You'll get it. I know the first time I learned this stuff, I was like, what? But yeah.

And yes, for some of you geniuses who already know arrays, we could have used a multi-dimensional array, but I don't want to blow people's brains apart too soon. We'll get to that eventually too.

Alright, you like that? You learned something new? Well, good. I hope you're enjoying it.

That's going to do it for part three, folks. That was a long one. I know that's a 16-minute lesson so far. I tried to split this up in two, but I couldn't split this into two or I'd lose people. You have to keep all that together. Sometimes it's going to be a five-minute lesson, sometimes it might be a 15-20-minute lesson, but I do my best.

Now, tune in tomorrow - same bat time, same bat channel - to watch part four. Let's see, you are watching this on Monday the 27th of November 2023, and I should post the other one very soon. Members can watch it right now, but not right now right now because I haven't recorded it yet. But members can watch videos as soon as they are posted. You don't have to wait for them to go live on YouTube.

But that, my friends, is going to do it for part three. That's your TechHelp video for today. I hope you learned something.

Live long and prosper, my friends. I'll see you next time. If you enjoyed this video, please give me a thumbs up and post any comments you may have below. I do try to read and answer all of them as soon as I can.

Make sure you subscribe to my channel, which is completely free. Click the bell icon and select all to receive notifications when new videos are posted.

Want to learn more? Click the Show More link below the video to find additional resources and links. YouTube does a pretty good job of hiding it. It's right down there. See this part of the description here? The name, the video is up here. There's a little "show more" down there right at the bottom. It's kind of hard to find, but once you click on that, you'll see a list of other videos, additional information related to the current topic, free lessons, and lots more.

YouTube no longer sends out email notifications when new videos are posted like they used to do. But if you'd like to get an email every time I post a new video, click on the link to join my mailing list. You can pick how frequently to get emails from me - either as they happen, daily, weekly, or monthly.

If you'd like to become a paid member of my channel and receive all kinds of awesome perks, click on the Join button. You'll see a list of all the different membership levels that are available, each with its own special perks, including my extended cut videos, access to my code vault (lots of VBA source code in there), template downloads, and lots more. I'll talk more about these perks at the end of the video.

Even if you don't want to commit to becoming a paid member and you'd like to help support my work, please feel free to click on the tip jar link. Your patronage is greatly appreciated and will help keep these free videos coming. I got some puppies to feed. But don't worry, no matter what, these free TechHelp videos are going to keep coming. As long as you keep watching them, I'll keep making more and they'll always be free.

Now, if you really want to learn Access and you haven't tried my free Access Level 1 course, check it out now. It covers all the basics of Microsoft Access, including building forms, queries, reports, and more. It's over four hours long. You can find it on my website or on my YouTube channel. I'll put a link down below you can click on. Did I mention it's completely free? The whole thing, free, four hours. Go watch it.

A lot of you have told me that you don't have time to sit through a four-hour course, so I do now have a quicker Microsoft Access for Beginners video that covers all the basics faster in about 30 minutes. And no, I didn't just put the video on fast forward. I'll put a link to this down below as well.

If you like Level 1, Level 2 is just a dollar. That's it. One dollar. And that's another whole 90-minute course. Level 2 is also free for paid members of any level, including supporters. So if you're a member, go watch Level 2. It's free.

Want to get your question answered in a video just like this one? Visit my TechHelp page and send me your question there. Members get priority, of course. While I do try to read and respond to all of the comments posted below in the comments section, I only have time to go through them briefly a couple of times a month. Sometimes I get thousands of them. So send me your question here on the TechHelp page and you'll have a better chance of getting an answer.

While you're on my website, be sure to stop by my Access Forum. We've got lots of lively conversations about Microsoft Access and other topics. I have a fantastic group of moderators who help me answer questions. Shout out to Alex, Kevin, Scott, Adam, John, Dan, Juan, and everybody else who helps on the site. I appreciate everything you do. I couldn't do it without you.

Be sure to follow my blog, find me on Twitter, and of course on YouTube. I'm on Facebook too, but I don't like Facebook. Don't get me started.

Now, let's talk more about those member perks if you do decide to join as a paid member.

There are different levels: Silver, Gold, Platinum, and Diamond.

Silver members and up get access to all of my extended cut TechHelp videos, one free beginner class every month, and some other perks.

Gold members get all the previous perks plus access to download the sample databases that I build in my TechHelp videos, plus access to my code vault where I keep tons of different functions that I use, the code that I build in most of the videos. You'll also get higher priority if you do submit any TechHelp questions. Now, answers are never guaranteed, but you do go higher in the list to meet the algorithm, and if I like your question, you got a good chance of it being answered. You'll also get one free expert level class each month after you've finished the beginner series.

Platinum members get all the previous perks plus even higher priority for TechHelp questions. You get access to all of my full beginner level courses for every subject. I cover lots of different subjects like Word, Excel, VBA, ASP, lots of different stuff - not just Access. These are the full length courses found on my website. You get all the beginner ones. In addition, once you finish the expert classes, you get one free developer class per month. So, lots of training.

Finally, you can also become a Diamond sponsor. You'll have your name or your company name listed on a sponsors page that will be shown on each video as long as you're a sponsor. You'll get a shout out in the video and a link to your website or product in the text below the video and on my website.

So that's it. Once again, my name is Richard Rost. Thank you for watching this video brought to you by AccessLearningZone.com. I hope you enjoyed. I hope you learned something today.

Live long and prosper, my friends. I'll see you again soon.
Quiz Q1. What is the main reason for using name value (key value) pairs separated by semicolons in the custom message box project?
A. To send multiple pieces of data into the form using a single string
B. To increase database security
C. To make VBA code execute faster
D. To ensure compatibility with SQL Server

Q2. Why does the video recommend not including semicolons or equal signs in any argument values sent as open args?
A. Because they might be misunderstood as delimiters during string splitting
B. Because Access does not allow these characters in strings
C. Because semicolons and equal signs take up too much memory
D. Because they are reserved keywords in VBA

Q3. What VBA function is used to split the argument string into an array based on a delimiter?
A. Split
B. Join
C. Replace
D. Format

Q4. After splitting the open args string by semicolons, what is the next step to extract names and values?
A. Split each resulting element by the equal sign into a second array
B. Use the Replace function to substitute spaces
C. Sort the array alphabetically
D. Concatenate the array elements into a single string

Q5. What does the use of LBound and UBound in the loop provide?
A. The ability to loop through any size of the array safely
B. The ability to filter out unwanted values
C. The capability to join two arrays together
D. It finds the length of a string, not an array

Q6. Why is a label used for the prompt area instead of a text box?
A. A label cannot be edited by the user
B. A label cannot display text
C. Labels are always larger in size
D. Text boxes are not supported in Access forms

Q7. In the handler code for assigning values, what structure is used to check for different names (such as "title" or "prompt")?
A. Select Case statement
B. For Each loop
C. Nested While loop
D. DoEvents function

Q8. What is the role of checking UBound(nameValue) = 1 before assigning values?
A. To verify that both a name and a value exist for each name value pair
B. To force an error if too many arguments are passed
C. To check if the array is empty
D. To count how many equal signs are in the string

Q9. What practical benefit does using optional parameters (such as title) in the message box function provide?
A. Allows users to omit the title if not needed and default it to an empty string
B. Prevents argument errors during database queries
C. Increases memory available to the function
D. Stops the function from running if input is missing

Q10. Why is it recommended to use 'variant' type when working with arrays in this lesson?
A. Because arrays can have different data types and sizes
B. Because variant makes code run the fastest
C. Because Access does not support other data types
D. Because it automatically encrypts the data

Q11. What is the primary purpose of using debug compile and temporary message boxes in the lesson?
A. To test and verify that data is being passed and parsed correctly
B. To make code look more complicated to others
C. To prevent any user from accessing the form
D. To reset the form each time it is opened

Q12. According to the video, who is intended to interact directly with the custom message box function and its open args feature?
A. The developer or programmer
B. The database end user
C. The Access system administrator only
D. The network administrator

Q13. Why are arrays taught and emphasized in this part of the series?
A. Because they are essential for breaking down and managing multiple parameters efficiently
B. Because every function in VBA requires arrays
C. Because arrays automatically validate all input
D. Because arrays prevent access to global variables

Q14. What did the instructor say could be used instead of open args for passing data, even though it is not shown in this lesson?
A. TempVars, global variables, or a table
B. Command line arguments only
C. Only SQL statements
D. Macro parameters exclusively

Q15. What is the instructor's advice if the student does not understand the array parsing technique at first?
A. Review the lesson multiple times, as understanding will improve with repetition
B. Abandon arrays and use single variables only
C. Use advanced multi-dimensional arrays immediately
D. Skip directly to the next part of the course


Answers: 1-A; 2-A; 3-A; 4-A; 5-A; 6-A; 7-A; 8-A; 9-A; 10-A; 11-A; 12-A; 13-A; 14-A; 15-A

DISCLAIMER: Quiz questions are AI generated. If you find any that are wrong, don't make sense, or aren't related to the video topic at hand, then please post a comment and let me know. Thanks.
Summary Today's TechHelp tutorial from Access Learning Zone continues with part three of my series on creating a custom message box in Microsoft Access. If you have not yet watched parts one and two, I recommend you tackle those first, as each part builds on what we have already covered.

Today, we are taking things up a notch with some deeper coding concepts, focusing primarily on working with arrays and the Split function. If you are not familiar with arrays or have not seen my video on the Split function, I recommend checking those out as well. We will be using these tools to handle multiple arguments for our custom message box by breaking up information into manageable pieces and storing them in arrays.

In our previous lesson, we discussed how to send data into a form using the OpenArgs property. However, OpenArgs only allows for a single string of data, and that will not suffice if we want to customize various aspects of our message box such as the prompt, background color, caption, button types, and positioning.

The solution is to use name-value pairs. You have likely seen this format before: something like firstName=Rick; lastName=Ross; phone=555-5555. Each piece of data is labeled and separated by a semicolon, which serves as a delimiter. We are going to combine our name-value pairs into a single string and pass that to the form via OpenArgs. Just remember, since we are using the semicolon and equal sign as delimiters, you should not include those characters in the argument values.

Once the form receives this combined string, we will split the string into an array based on the semicolon separator, giving us an array of name-value pair strings. Then, for each element in this array, we split again, this time on the equal sign, to separate the name and value into another array.

Armed with this approach, let's walk through adding the prompt area to our form. Since we do not want the user to accidentally edit the prompt, a label works better than a text box. In design view, we place a label where we want the prompt to appear, give it some default text, format it as needed (dark blue, bold, perhaps a size 18 font), and, importantly, assign it a meaningful name such as "prompt". This makes it easier to reference in our code.

Now, let's move over to our global module where the custom message box function lives. Previously, our function simply took a single string for the prompt. To expand this, we want to allow for both the prompt and an optional title. If the title is not supplied, it should default to an empty string, just like the built-in MsgBox function, which uses "Microsoft Access" if no caption is provided.

For clarity and alignment with the built-in MsgBox, the function will accept the prompt as a string and the title as an optional string. We construct our arguments string in the format prompt=[whatever]; title=[whatever]; making sure to include the semicolon after each name-value pair. If a title is given, we append it; otherwise, we just send the prompt.

To verify the arguments string is constructed correctly, we use a standard message box to display it. This quick verification step helps ensure we are building the string as expected.

Once the argument string is ready, we get to the crucial part: parsing it in the form. Back in the form's code, we declare our variables, using the Variant type since arrays in VBA are typically stored in variants. We need one array to hold the split name-value pair strings, and a second array for splitting each pair individually. We also declare a counter variable for looping through the array.

Instead of just assigning OpenArgs to a variable, we use the Split function to break up the argument string using the semicolon as the delimiter. This gives us an array where each element is a name-value pair, such as "prompt=Welcome Cadets" or "title=Starfleet Academy".

We then loop through the array using the LBound and UBound functions to determine the array's starting and ending indexes. This approach is preferred because VBA arrays can start at either zero or one, depending on how they're created.

Inside this loop, we split each element again, this time on the equal sign, to isolate the name and value. We make a quick check to ensure each pair splits correctly (yields exactly two items), then proceed to process the data. For each valid pair, we use a Select Case block: if the name is "title", we set the form's caption accordingly; if the name is "prompt", we set our label's caption to the value.

An important note: this function is meant for you, the developer, not end users. You control the input, so rigorous error handling is kept to a minimum for simplicity's sake.

After wiring up the arguments and processing logic, you should test your work. Sending an OpenArgs string into the form allows the form to split and process the name-value pairs, setting the caption and prompt as specified.

There are, of course, many ways to send multiple arguments to a form, including using TempVars, global variables, or tables. Here, the goal is to teach you a valuable technique using arrays and the Split function — skills that are foundational in VBA programming.

You may need to review these steps a couple of times for everything to sink in, especially if arrays are new to you. The more you practice, the more intuitive it becomes. We will be expanding on this approach in future lessons, adding more customization options along the way.

For those more experienced among you, yes, we could use multi-dimensional arrays, but I want to keep it straightforward for now. That complexity will come later.

That wraps up part three of our custom message box series. This was a longer lesson, but keeping all this material together was important. Next up will be part four, so keep an eye out for that. Members will have access as soon as it is posted.

If you want to keep learning more about Access and VBA, be sure to check out my free Access Level 1 course which covers all the basics. It is over four hours of free video content, both on my website and on YouTube. If you prefer a faster overview, look for my 30-minute Access for Beginners video.

If you enjoy these lessons, please consider subscribing to my channel. You can also join my mailing list or become a paid member for additional perks, including extended cut videos, downloadable sample databases, access to my code vault, and more. Anyone can also visit my website to ask questions, join lively discussions in the Access Forum, or just browse additional resources.

If you are ever interested in supporting my work further, you might want to look at the various membership levels, each offering different benefits, such as monthly free courses, higher priority for TechHelp questions, and access to more advanced materials. Details on these perks, as well as free content, can be found on my website.

For everything discussed here, you can find a complete video tutorial with step-by-step instructions on my website at the link below.

Live long and prosper, my friends.
Topic List Building a custom message box using name value pairs
Passing multiple arguments to a form using OpenArgs
Delimiting parameter strings with semicolons and equal signs
Splitting parameter strings into arrays in VBA
Parsing OpenArgs data into name value arrays
Adding and configuring a label control for prompt text
Formatting label appearance in design view
Naming controls for easier reference in code
Building an argument string from function inputs
Handling optional arguments in VBA functions
Testing argument strings with a message box
Parsing arguments inside the form's Load event
Using LBound and UBound to loop through arrays
Splitting each array element into name and value
Validating array splits for name value integrity
Using the Select Case statement to process parameters
Assigning the form's caption from parsed parameters
Assigning the prompt label's caption from parsed parameters
Debugging and compiling the code for logical errors
Demonstrating the working custom message box with sample values
 
 
 

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 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 2/12/2026 11:58:37 PM. PLT: 2s
Keywords: TechHelp Access 2016, Access 2019, Access 2021, Access 365, Microsoft Access, MS Access, MS Access Tutorial, #msaccess, #microsoftaccess, #help, #howto, #tutorial, #learn, #lesson, #training, #database, Custom Dynamic MsgBox, Custom MsgBox in Access, mult  PermaLink  Custom MsgBox in Microsoft Access, Part 3