title: MS Access 2016 VBA Error "Invalid Operation" It is showing the error with the First IF statement in the second CASE
body: <pre><code>Option Compare Database
  Option Explicit
  Public Function Day1DU(InvFullBP As Single) As Single
  
  Dim Current_Frm As Form
  Set Current_Frm = Screen.ActiveForm
  Dim CalcDuAdjs As Double, HBCO As Double, HBP As Double, AMRF As Double
  </code></pre>
  <p>Only my second time posting so please be nice.
  I need to see if there is a value in the field FundDate of the SoldInfo_Tbl. If the field is blank then we need to assume 9/1/2020. If it is not null the it needs to be greater than 8/31/2020 to run the code.
  I have never looked for a value this way. I have always referred to the current form.
  Having issues with DAO.Database</p>
  <p>ADVERSE MARKET REFINANCE FEE</p>
  <pre><code>Dim dbMyDB As DAO.Database
  Dim tblSoldInfo As DAO.TableDef
  Dim fldMyField As DAO.Field
  Dim rs As DAO.Recordset
  
  Set dbMyDB = CurrentDb
  Set tblSoldInfo = dbMyDB![SoldInfo_Tbl]
  Set fldMyField = tblSoldInfo![FundDate]
  Set rs = CurrentDb.OpenRecordset(&quot;SoldInfo_Tbl&quot;, dbOpenTable)
  </code></pre>
  <p>ADVERSE MARKET REFINANCE FEE</p>
  <pre><code>Select Case Val(Current_Frm!InvestorID_Cbo.Column(0))
  Case 2, 4, 15
      If Current_Frm!RateSheetDate_Txt &gt; #8/12/2020# Then
        If Current_Frm!LoanType_Cbo &lt;&gt; &quot;PURCHASE&quot; And (Current_Frm!Plan_Cbo = &quot;10&quot; Or Current_Frm!Plan_Cbo = &quot;20&quot; Or Current_Frm!Plan_Cbo = &quot;11&quot; Or Current_Frm!Plan_Cbo = &quot;55&quot; Or Current_Frm!Plan_Cbo = &quot;71&quot; Or Current_Frm!Plan_Cbo = &quot;101&quot; Or Current_Frm!Plan_Cbo = &quot;12&quot; Or Current_Frm!Plan_Cbo = &quot;10H&quot; Or Current_Frm!Plan_Cbo = &quot;20H&quot; Or Current_Frm!Plan_Cbo = &quot;55H&quot; Or Current_Frm!Plan_Cbo = &quot;71H&quot; Or Current_Frm!Plan_Cbo = &quot;101H&quot; Or Current_Frm!Plan_Cbo = &quot;11H&quot; Or Current_Frm!Plan_Cbo = &quot;12H&quot;) Then
          AMRF = 0.5
        Else
          AMRF = 0
        End If
      End If
  Case 16, 17
  </code></pre>
  <p>My issue below vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv</p>
  <pre><code>    If Nz(rs![tblSoldInfo]![fldMyField], #9/1/2020#) &gt; #8/31/2020# Then
        If Current_Frm!LoanType_Cbo &lt;&gt; &quot;PURCHASE&quot; And (Current_Frm!Plan_Cbo = &quot;10&quot; Or Current_Frm!Plan_Cbo = &quot;20&quot; Or Current_Frm!Plan_Cbo = &quot;11&quot; Or Current_Frm!Plan_Cbo = &quot;12&quot; Or Current_Frm!Plan_Cbo = &quot;10H&quot; Or Current_Frm!Plan_Cbo = &quot;20H&quot; Or Current_Frm!Plan_Cbo = &quot;11H&quot; Or Current_Frm!Plan_Cbo = &quot;12H&quot;) Then
          AMRF = 0.5
        Else
          AMRF = 0
        End If
      End If
  End Select
  </code></pre>
  <p>END ADVERSE MARKET refinance FEE</p>