Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm not sure why you think you should be using arrays. When it comes to the msgStr variable logic I would just put in the following:</p> <pre><code>msgStr = msgStr &amp; "Invoice Sent / " </code></pre> <p>rather than the five lines of If msgstr = "" Then, etc, etc, End If lines.</p> <p>Then at the end I would put in the following line </p> <pre><code>msgStr = lef(msgStr, len(msgStr) - 3) ' remove the trailing / </code></pre> <p>This then removes the trailing " / "</p> <p>Purists will tell you that you should never add anything to a string you later remove. I say, so long as you leave a comment there for the next person who is reading your code, this reduces complexity of your preceding lines of code making it much easier to grasp exactly what is going on.</p> <p>Whenever I'm looking for a value to be returned from a MsgBox I place the string creating in a separate line of code. Thus is much easier to see, at a glance, exactly what the code is doing.</p> <pre><code>strMsg = "You will lose data in the following areas as the relevant checkboxes are unticked." &amp; vbNewLine &amp; vbNewLine &amp; _ msgStr &amp; vbNewLine &amp; vbNewLine &amp; "Do you wish to continue?" If MsgBox(strMsg, vbYesNo, dbNameOf) &lt;&gt; vbYes Then _ Cancel = True </code></pre> <p>If I'm only setting one value in the If statement, such as you show, I will also put in the _ and thus not require the End If.</p> <p>I also prefer &lt;> vbYes just in case something wonky should happen or if someone, not you of course, mucks with the msgbox options.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload