VBA educational material (2 Viewers)

neuroman9999

Member
Local time
Today, 18:31
Joined
Aug 17, 2020
Messages
827
I am currently teaching 2 beginners the VBA language. One in Asia and one in Europe. So I thought I would post these 31 lessons I have written for them. If you are a beginner, you might be able to make good use of this material. You can thank me later. I wish you happy learning. :)

On google's cloud drive:
Lessons 1-8 => https://drive.google.com/file/d/1sOCnYxDyw28RNFAcNFouEPnOtrcmqe9S/view?usp=sharing
Lessons 9-16 => https://drive.google.com/file/d/1T38N541P3eKNs_Kk-243EhKr5TxgKZCt/view?usp=sharing
Lessons 17-23 => https://drive.google.com/file/d/15Cw-k02OarQfuXy4yEBqDRUyoBUy_pHS/view?usp=sharing
Lessons 24-31 => https://drive.google.com/file/d/1GCm_ECZs1HuzLdJb78lNr1c7yE52p1n6/view?usp=sharing
ALL lessons => https://drive.google.com/file/d/1U5ZzvB0hyo0N36agCDFBjfqD65-Ir6j9/view?usp=sharing
 

Attachments

  • VBA_lessons_1-8.zip
    113.4 KB · Views: 607
  • VBA_lessons_9-16.zip
    201.6 KB · Views: 553
  • VBA_lessons_17-23.zip
    138.5 KB · Views: 501
  • VBA_lessons_24-31.zip
    191.3 KB · Views: 514
  • VBA_lessons_ALL.zip
    609.4 KB · Views: 593
Last edited:

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 07:31
Joined
May 7, 2009
Messages
19,169
i only have a glimpse.

one comment, on problem #31.
the querydef object does not have a Delete method.
Delete method is in the querydefs collection object.
 

moke123

AWF VIP
Local time
Today, 19:31
Joined
Jan 11, 2013
Messages
3,852
Also what is a querydes?
 

neuroman9999

Member
Local time
Today, 18:31
Joined
Aug 17, 2020
Messages
827
Well well well you guys. Thank you for pointing out those very subtle mistakes. It seems as though Richard and I suffer from the same problem. I will make the changes you guys have pointed out and reupload the archives. Thanks.
 

moke123

AWF VIP
Local time
Today, 19:31
Joined
Jan 11, 2013
Messages
3,852
I only looked at the one Arnel looked at. I'm sure there are many more errors. You should probably wait until everyone goes through it and save yourself some time.
 

neuroman9999

Member
Local time
Today, 18:31
Joined
Aug 17, 2020
Messages
827
I only looked at the one Arnel looked at. I'm sure there are many more errors. You should probably wait until everyone goes through it and save yourself some time.
MANY errors? don't bet on it. I don't claim to know everything, but the 2 errors you guys both pointed out are so marginal, no student would probably even notice. they aren't even errors really. If you compare this stuff with a typical ""educational professional"", there is no comparison. professors are not the smartest in the world.
 

harpygaggle

Registered User.
Local time
Today, 16:31
Joined
Nov 22, 2017
Messages
128
I am currently teaching 2 beginners the VBA language. One in Asia and one in Europe. So I thought I would post these 31 lessons I have written for them. If you are a beginner, you might be able to make good use of this material. You can thank me later. I wish you happy learning. :)

On google's cloud drive:
Lessons 1-8 => https://drive.google.com/file/d/105UMSjwFf6Gdu5tUboDB3o-jB4gzmUE2/view?usp=sharing
Lessons 9-16 => https://drive.google.com/file/d/1zgoNYzfYgJqFIj9s2-NO0C8Eae8OasvR/view?usp=sharing
Lessons 17-23 => https://drive.google.com/file/d/1Z9uOYCTtt2sM2css4MEmQ4j6PGfwdLAH/view?usp=sharing
Lessons 24-31 => https://drive.google.com/file/d/10Yts06UiqjPR006WIzImhMhRxePZ-PSF/view?usp=sharing
ALL lessons => https://drive.google.com/file/d/11vrdUd7MdPSy8UTYAhOV57D18E-QoDoD/view?usp=sharing
WOw!!!! Thank you for this sir - glad for these lessons :love:🙌
 

neuroman9999

Member
Local time
Today, 18:31
Joined
Aug 17, 2020
Messages
827
all errors have been fixed, that I could find anyway. I look forward to your genius-level analysis, @moke123 . good luck. :rolleyes: ;)
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 18:31
Joined
Feb 28, 2001
Messages
27,001
Adam, you are skirting the "disrespect" line in the sand again. Because it is POSSIBLE that there might have been a minor level of provocation, I am not giving you a time-out. But your attitude is part of what causes folks to react to you as they do. Your direct comments are at question, but also your "asides" in post #4 and #8 are objectionable. You threw in two gratuitous remarks my way when I hadn't yet stepped in to the discussion. It happened that this time you blasted me in the asides, but you then blasted moke123 directly in #9 and #11. When someone says "Sorry, not interested" you make a snide remark. This HAS GOT TO STOP. There is no disrespect in a statement that says "Sorry, not interested."

Now, as to the business of your lessons:

You need to be careful because you are using a variable called return as a return value from several code sequences, but it happens that return is also a reserved word in VBA, as an action verb meaning "go back to whatever called you." It is generally not a good idea to use reserved words as variables. In some cases, they can be "qualified" with a prefix, but in other cases they can run wild. Actually, for function returns you CAN use return to return a value, but not using the syntax as you show it. Using return as a variable inside a function that potentially would have a "natural" return statement is asking for syntax trouble.


You also have something that for teaching purposes MIGHT be OK - but might equally be very misleading. Exercise 14 has two local variables ReturnX and ReturnY. You assign values to them. Then you ask their probable values when the code finishes executing. Since you include the End Sub as part of the demonstration code, the technically correct answer is "non-existent." You have to recognize that End Sub is executable, too! It acts just like Exit Sub if your code falls through to it. So when the code has finished, all locally declared variables have been dissolved and no longer exist anywhere.

Finally, if you are going to teach, then TEACH. Your style appears as though you are giving out tests that someone might try as experiments in an Access environment. My criticism is that a beginner might not know how to get to a VBA coding page, much less how to start execution of code at a selected place, to test what you have shown. When they hit the code where you are trying to demonstrate syntax errors, they will face situations of error handling, for which they could EASILY panic. You have no instructions for using that set of "lessons" and that leads to another conceptual problem. You are shooting at a mixed target - on the one hand that someone would know how to activate the code snippets you are showing, on the other that if they CAN get to that point, that they don't already know this kind of stuff. And on the third hand, that the answers to your questions require pointers to reference material. (OK, I've been re-reading my Edgar Rice Burroughs "Mars" series, where third hands are possible. And fourths as well. Thark you very much...)

Without a decent preface, explanation, or usage instructions, the proper utilization of these "lessons" is ambiguous at best and unknowable at worst. We would have to name your series Adam's VBA Coding for Genius-Dummies.
 

neuroman9999

Member
Local time
Today, 18:31
Joined
Aug 17, 2020
Messages
827
I'm not going to listen to anything you said richard. You have to remember who the audience of these things are. Technicalities in terms of what a professional knows is totally irrelevant. This is just the first post and I will follow up with you later after I read all of what you have written.
 

Umpire

Member
Local time
Today, 16:31
Joined
Mar 24, 2020
Messages
120
Adam, you are skirting the "disrespect" line in the sand again. Because it is POSSIBLE that there might have been a minor level of provocation, I am not giving you a time-out. But your attitude is part of what causes folks to react to you as they do. Your direct comments are at question, but also your "asides" in post #4 and #8 are objectionable. You threw in two gratuitous remarks my way when I hadn't yet stepped in to the discussion. It happened that this time you blasted me in the asides, but you then blasted moke123 directly in #9 and #11. When someone says "Sorry, not interested" you make a snide remark. This HAS GOT TO STOP. There is no disrespect in a statement that says "Sorry, not interested."

Now, as to the business of your lessons:

You need to be careful because you are using a variable called return as a return value from several code sequences, but it happens that return is also a reserved word in VBA, as an action verb meaning "go back to whatever called you." It is generally not a good idea to use reserved words as variables. In some cases, they can be "qualified" with a prefix, but in other cases they can run wild. Actually, for function returns you CAN use return to return a value, but not using the syntax as you show it. Using return as a variable inside a function that potentially would have a "natural" return statement is asking for syntax trouble.


You also have something that for teaching purposes MIGHT be OK - but might equally be very misleading. Exercise 14 has two local variables ReturnX and ReturnY. You assign values to them. Then you ask their probable values when the code finishes executing. Since you include the End Sub as part of the demonstration code, the technically correct answer is "non-existent." You have to recognize that End Sub is executable, too! It acts just like Exit Sub if your code falls through to it. So when the code has finished, all locally declared variables have been dissolved and no longer exist anywhere.

Finally, if you are going to teach, then TEACH. Your style appears as though you are giving out tests that someone might try as experiments in an Access environment. My criticism is that a beginner might not know how to get to a VBA coding page, much less how to start execution of code at a selected place, to test what you have shown. When they hit the code where you are trying to demonstrate syntax errors, they will face situations of error handling, for which they could EASILY panic. You have no instructions for using that set of "lessons" and that leads to another conceptual problem. You are shooting at a mixed target - on the one hand that someone would know how to activate the code snippets you are showing, on the other that if they CAN get to that point, that they don't already know this kind of stuff. And on the third hand, that the answers to your questions require pointers to reference material. (OK, I've been re-reading my Edgar Rice Burroughs "Mars" series, where third hands are possible. And fourths as well. Thark you very much...)

Without a decent preface, explanation, or usage instructions, the proper utilization of these "lessons" is ambiguous at best and unknowable at worst. We would have to name your series Adam's VBA Coding for Genius-Dummies.
THANK-YOU! As a person that is an Electronics tech by training and now being pressed into service to write and maintain a database, this is a problem I run into a lot, when using this site. People assume a level of knowledge about writing code in general and VBA in particular that not everyone has. I have made things work but taking them to the next level is EXTREAMLY hard because of the assumed knowledge that just is not there yet.
 

neuroman9999

Member
Local time
Today, 18:31
Joined
Aug 17, 2020
Messages
827
This HAS GOT TO STOP. There is no disrespect in a statement that says "Sorry, not interested."

that's questionable. but I would tend to think you are correct. Moke obviously has a dislike of me to some degree, but then again, it seems to me that there is some sort of liking to me as well. It comes with the territory. smart minds both dislike and like one another. it's a constant challenge, borne out of boredom if anything. It will stop then. not to worry. ;)

You need to be careful because you are using a variable called return as a return value from several code sequences, but it happens that return is also a reserved word in VBA, as an action verb meaning "go back to whatever called you." It is generally not a good idea to use reserved words as variables. In some cases, they can be "qualified" with a prefix, but in other cases they can run wild. Actually, for function returns you CAN use return to return a value, but not using the syntax as you show it. Using return as a variable inside a function that potentially would have a "natural" return statement is asking for syntax trouble.

did you miss the point of me including the word return in the lessons, Richard? Apparently you did. It was meant to foreshadow for the curious learner. But you didn't spot that, did you? Here are some clues, and let me know if you now can follow me:






You also have something that for teaching purposes MIGHT be OK - but might equally be very misleading. Exercise 14 has two local variables ReturnX and ReturnY. You assign values to them. Then you ask their probable values when the code finishes executing. Since you include the End Sub as part of the demonstration code, the technically correct answer is "non-existent." You have to recognize that End Sub is executable, too! It acts just like Exit Sub if your code falls through to it. So when the code has finished, all locally declared variables have been dissolved and no longer exist anywhere.

that whole paragraph is WAY TOO TECHNICAL for beginners. they wouldn't know what the hell you were talking about. Take for example, Elena, the girl I technically stole from @isladogs . Do you think that girl would follow that crap!? Take a look at the following images for why I'm right in my leadership, and you are wrong, for people who can't possibly follow us for many months at the VERY LEAST:

11111.jpg


22222.jpg


the answers to your questions require pointers to reference material.

that's why I tell EVERYONE to do stuff like THIS:





it's not THAT tough, ya know. My God. :rolleyes:

Without a decent preface, explanation, or usage instructions, the proper utilization of these "lessons" is ambiguous at best and unknowable at worst.

young people don't pay attention. you wanna get their attention? don't bore their asses to tears with prefaces, books, lectures, college coursework that does nothing, and professors that charge them 30K a year for tuition to line their own pockets, and teach nothing relevant to life after school.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 18:31
Joined
Feb 28, 2001
Messages
27,001
So you don't care that you are offering incorrect material?

"Foreshadowing" using a syntax that will raise an error isn't forshadowing - it is screwing up. Don't forget that I am an amateur writer as a part-time hobby. I FULLY understand the concept of foreshadowing. It will be nice having peace and quiet around here for a while if you keep on giving incorrect advice. Now THAT is an example of foreshadowing.

I don't give a rat's patootie that young people don't pay attention. Ten years later, they will still be unemployed and will still be stuck in low-end jobs despite whatever potential they might have had. And by propagating incorrect information and passing it off as training, you perpetuate that condition; you don't help it any.
that whole paragraph is WAY TOO TECHNICAL for beginners.

Wasn't intended for beginners. It was a critique of YOUR work, intended for YOUR eyes. Or are you now calling yourself a beginner?
 

neuroman9999

Member
Local time
Today, 18:31
Joined
Aug 17, 2020
Messages
827
Or are you now calling yourself a beginner?

hardly, mr. genius. and you know that. don't make yourself look like a fool. and, I've corrected one sample for you. very good of you to catch the ""technical mistake"". although it still doesn't matter to most beginners because they have no clue what they're doing anyway. see images...

original content
1.jpg


proof of mistake

2.jpg


compiler error proof

3.jpg


substitute method, with similar intended meaning

4.jpg
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 18:31
Joined
Feb 28, 2001
Messages
27,001
Adam, that is all I was pointing out - the incautious use of return as a variable name is a bad teaching example. You asked us to look at the lessons. We did. Don't, then, go ballistic if we comment on what we saw. There is an old rule that says, "If you don't want to hear a particular answer, it is wise to not ask the question in the first place."
 

neuroman9999

Member
Local time
Today, 18:31
Joined
Aug 17, 2020
Messages
827
There is an old rule that says, "If you don't want to hear a particular answer, it is wise to not ask the question in the first place."

I did NOT get out of control, sir. if you didn't even notice what I was trying to show you in the correction, I used the variable called ret. do you know what the significance of that is? you probably wouldn't if you don't do web dev. work.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 18:31
Joined
Feb 28, 2001
Messages
27,001
Adam, I could not possibly care less.
 

Users who are viewing this thread

Top Bottom