Better VBA 2 - Variable Names

  Рет қаралды 4,633

codekabinett.com/en

codekabinett.com/en

Күн бұрын

Пікірлер: 9
@MD-xs6fx
@MD-xs6fx 3 жыл бұрын
Definitely good practice! Thanks!
@ashishtrivedi8253
@ashishtrivedi8253 2 жыл бұрын
Thx for understanding.👍
@codekabinettcomen
@codekabinettcomen Жыл бұрын
You're welcome 😊
@rumi9005
@rumi9005 2 жыл бұрын
I usually include a prefix of some kind in the name to supply more information about my variable names (and field names in tables). For example - sCustCode - Shows that the code is a string. nCustCode would mean it's a numeric. Some programmers might use strCustCode and intCustCode (if it's an integer). And in my customer table I'd likely use c_CustCode - using 'c_' to show the field belongs to the table titled Customers. In the Sales table I'd likely name it s_CustCode. That makes a big difference when using recordsets of linked tables. If the field name was simply CustCode in BOTH tables, the first usage of CustCode would show as CustCode but the second HAS to be something else. So the recordset will instead substitute a (likely) pretty unintelligible temporary field name on the fly, making debugging a lot more of a challenge. It will be particularly challenging if the recordset refers to two DIFFERENT customers for some reason. Probably won't happen with the Customer Code, however. But the same problem might easily arise with other fields - fields that are similar in context but hold different data in that particular recordset. Total, for example. In a one-to-many relationship (sales by customer, for example) the same field name could easily refer to total sales for the customer AND the total for each particular sale.
@codekabinettcomen
@codekabinettcomen 2 жыл бұрын
Thank you for this feedback. Whether data type prefixes for variables make sense is a longer topic. - Actually already on my list for future videos. - TL;DR: I don't use that anymore. Regarding the issue with query output columns, I think you are trying to fix the problem at the wrong end. If there are columns in the query result which become ambiguous due to the nature of the query, these column names should be aliased to more sensible names right there in the query. For an info on aliases see: codekabinett.com/rdumps.php?Lang=2&targetDoc=sql-as-alias
@sudhirbethekar1779
@sudhirbethekar1779 2 жыл бұрын
Its nice to see you back in the role .... would you please explain class and class property in deep but in simple way? as you do in every time you do.
@wilsonfineart
@wilsonfineart 5 жыл бұрын
Well done! Thanks for sharing that. Might say ">= MINIMUM_VALID_DATE" depending on your requirements.
@vinaydubey9590
@vinaydubey9590 6 жыл бұрын
please donot use music sir
Better VBA 3 - Constants
7:18
codekabinett.com/en
Рет қаралды 4,7 М.
Better VBA 1 - VBA Editor Settings
15:15
codekabinett.com/en
Рет қаралды 17 М.
Quando A Diferença De Altura É Muito Grande 😲😂
00:12
Mari Maria
Рет қаралды 22 МЛН
How many people are in the changing room? #devil #lilith #funny #shorts
00:39
Naming Things in Code
7:25
CodeAesthetic
Рет қаралды 2,3 МЛН
Better VBA 0 - Introduction
8:31
codekabinett.com/en
Рет қаралды 5 М.
VBA For Beginners: Mastering Variables Like A Pro
24:30
Excel For Freelancers
Рет қаралды 19 М.
Beat Ronaldo, Win $1,000,000
22:45
MrBeast
Рет қаралды 107 МЛН
Windows API in VBA - First Steps
17:47
codekabinett.com/en
Рет қаралды 9 М.
Better VBA 4 - Using Enums (Enumerations) in VBA
9:26
codekabinett.com/en
Рет қаралды 9 М.
Object Orientation in Access / VBA - Should we use it?
19:39
codekabinett.com/en
Рет қаралды 4,1 М.
Why 2025 Will Be The Year of AI Agents
5:11
Bloomberg Technology
Рет қаралды 21 М.