A family of Microsoft relational database management systems designed for ease of use.
RunningManHD, I have carefully looked at your comments. I think that the DIM of a list of variables is a legitimate syntax. I submit as reference the following URL:
https://msdn.microsoft.com/en-us/library/7ee5a7s1.aspx
The long names have troubled me but if someone other than myself looks at the code, I would want them to be able to follow what I have done. The Camel-Case notation is an alternate method . In my system of notation the underscores purpose is to keep each variable a single text string.
Thanks.
Michael
Michael,
Let me address your first statement and the reference you provided. That reference is for Visual Studio 2015/Visual Basic (VB), not Visual Basic for Applications (VBA). If you declare your variables without explicitly defining the data type, then those undefined variables will default to variant. If a variant data type is your intention for those variables not explicitly defined, then all is well. However, if you expect that the following declaration defines all of your variables as integer, you are mistaken.
Dim Search_Municipal, Search_Legislator, Search_Government_Official, Search_ILC_Check As Integer
The first three are variants. If you doubt what I'm telling you, a simple test will prove my point.
Place the following code just below your declaration and run your procedure.
Debug.Print VarType(Search_Municipal)
Debug.Print VarType(Search_Legislator)
Debug.Print VarType(Search_Government_Official)
Debug.Print VarType(Search_ILC_Check)
Check the immediate window for the results. What you will see is:
0
0
0
2
Another piece of advice is to define all of your variables at the head of the procedure, not throughout your code. It is a best practice and it makes it a lot easier for the developer that follows behind you. A practice I prefer to use is to define each of my variables separately, one below the other, not in-line as you have done.
As to your last statement about using underscores, I'm afraid I don't follow you. You say that you are using underscores to keep variables as a single text string. That doesn't make a lot of sense to me.
Lastly, be sure you read through what Tom has posted. He makes some additional good observations about your coding that you should make note of.
I'm glad you were able to spot your error problem. Best of luck in your future coding.
RM