title: Calculate Number of Working Days without Holidays & Weekends
body: <p>How can I calculate the number of working days between two dates without counting Saturdays, Sundays and holidays.</p>
  
  <p>I have a table with the following fields:
  <a href="https://i.stack.imgur.com/DGl6u.png" rel="nofollow noreferrer">enter image description here</a></p>
  
  <p>I have the following table and what I want is that in the column called expr1 calculate the difference of working days.</p>
  
  <p>Enter the code into Visual Basic, and call workingdays to the module</p>
  
  <p><a href="https://i.stack.imgur.com/9YnGI.png" rel="nofollow noreferrer">enter image description here</a></p>
  
  <p>Replace the variables with the names of each column.</p>
  
  <pre><code>Function WorkingDays(ByVal FECHA_DE_VALIDACION_FA As Date, ByVal FECHA_IMPRESIÓN As Date) As Long
      While FECHA_DE_VALIDACION_FA &lt;= FECHA_IMPRESIÓN
          Select Case True
              Case Weekday(FECHA_DE_VALIDACION_FA, vbMonday) &gt; 5
              Case DCount("*", "Holidays", "Holiday = #" &amp; Format(fromDate, "mm/dd/yyyy") &amp; "#") &gt; 0
              Case Else: WorkingDays = WorkingDays + 1
          End Select
          FECHA_DE_VALIDACION_FA = FECHA_DE_VALIDACION_FA + 1
      Wend
  End Function
  </code></pre>
  
  <p>Then they tell me that in the query with the generator call the function Workingdays, but it does not give me a result.</p>
  
  <p><a href="https://i.stack.imgur.com/D24Mr.png" rel="nofollow noreferrer">enter image description here</a>
  <a href="https://i.stack.imgur.com/ElvCn.png" rel="nofollow noreferrer">enter image description here</a></p>
  
  <p>I accept and run the query but I get an error.</p>