Access VBA Code problem

This Access VBA code is designed to manipulate characters in a string.  You enter your first name, middle initial and last name into the Input text box.

Then your press the “Initials” button and your initials appear in the “Answer” output box.

There are aspects of the code that I don’t understand:

I have used the F8 key to walk through the code and I see what is going on but don’t quite understand can someone walk through this code and explain each step?

Also “str5 As string” does not seem to be used in the code yet when I take it out the code breaks.
James CoatsComputer Info. Sys. StudentAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

OnisanCoder / ProgrammerCommented:
I was going to just comment the code until I realised it would be easier to re write it effectively and comment that.
So here is a much shorter and commented version.

I hope you don't mind
OnisanCoder / ProgrammerCommented:
Also here is the original code commented

I have to say it is bad code and should not be used in any production situation as shouldn't mine. Both require checks and error handling.

All the best

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
James CoatsComputer Info. Sys. StudentAuthor Commented:

Thank you so very much. This is a learning event for me. Sorry to subject you to such poor code but know that you are helping me to learn. The re-write was very instructive as was the commenting on the old code.

Thanks again.

OnisanCoder / ProgrammerCommented:
N o Problem,
We all start somewhere and some day you'll be the one answering questions on here.
All the best
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.