title: Setting Validation rules to multiple fields using VBA code returns error 3309 (too large)
body: <p>I would like to ask you for help with (edited) VBA code I found while searching for solution. My goal is to add validation rule to multiple field of table at once by VBA code. I have to use VBA code because there is so many fields and manual input would be insane.<br>
  Validation rule: <strong>NOT LIKE "*"+Chr(10)+"*" OR "*"+Chr(13)+"*" OR "*"+Chr(9)+"*"</strong><br>
  (user can't save "enter", "ctrl+enter" and "tabulator")<br>
  For using this rule in VBA function the syntax is quite different but input to MS Access is correct.</p>
  
  <p>My VBA code (not directly my, I found it and edit to my needs)</p>
  
  <pre><code>Public Function SetFieldValidation()
  
  Dim dbs As DAO.Database
  Dim tdf As DAO.TableDef
  Dim fld As DAO.Field
  Dim strValidRule As String
  Dim strValidText As String
  Dim bytNumOfFields As Byte
  
  strValidRule = "NOT LIKE " &amp; Chr(34) &amp; "*" &amp; Chr(34) &amp; "+Chr(10)+" &amp; Chr(34) &amp; "*" &amp; Chr(34) &amp; " OR " &amp; Chr(34) &amp; "*" &amp; Chr(34) &amp; "+Chr(13)+" &amp; Chr(34) &amp; "*" &amp; Chr(34) &amp; " OR " &amp; Chr(34) &amp; "*" &amp; Chr(34) &amp; "+Chr(9)+" &amp; Chr(34) &amp; "*" &amp; Chr(34)
  strValidText = "Some error msg"
  
  Set dbs = CurrentDb
  Set tdf = dbs.TableDefs("Table_Name")
  
  For bytNumOfFields = 0 To tdf.Fields.Count - 1
    With tdf.Fields(bytNumOfFields)
      If .Name &lt;&gt; "Record ID" Then
        .ValidationRule = strValidRule
        .ValidationText = strValidText
      End If
    End With
  Next
  End Function
  </code></pre>
  
  <p>In the past this script works with rule <strong>NOT LIKE "*"+Chr(10)+"*" OR "*"+Chr(13)+"*"</strong>.<br>
  Than tried to add <strong>OR "*"+Chr(9)+"*"</strong>.<br>
  Since this modification the MS Access (VBA) returns error: <strong>Property value is too large. (Error 3309)</strong> while I run the script. When I tried return to previous version of script without +Chr(9)+, the error still remains (even I succesfully used this script in the past and validation rules are set in another tables).</p>
  
  <p>I'm really beginer in VBA, honestly I only need to setup this rule to all field of all tables. Can someone experienced tell me what's wrong in the code?</p>
  
  <p>Thank you very much.</p>