How do I add one value to a variable every time a date field is null?

0

In Access 2013, I am working on a report. Using the On print event, I have a problem trying to add one value to a variable every time a date field is null. It works fine somaValores =Somavalores + 1

Tried IIF but it doesn’t work. Any ideas?

Private Sub Detalhe_Print(Cancel As Integer, PrintCount As Integer)
 Select Case Me!TipoMeta
    Case "Percentagem"
       Select Case Me!DtResposta
          Case Is  Me!DtLimite
             ForaPrazo = ForaPrazo + 1
*********************************************************
DTLIMITE IS A DATE TYPE FIELD 
HERE I NEED: CASE DTLIMITE = NULL THEN
CONTA = CONTA + 1 
**********************************************************
       End Select
    Case "Valores absolutos"
        SomaValores = SomaValores + 1
    Case "Data"
 End Select
End Sub

Emanuel

Posted 2016-03-18T13:15:25.423

Reputation: 57

Answers

0

I am unable to test this, but I think your are looking for ISNULL withing your Case.

   If IsNull (DTLIMITE) Then 
      CONTA = 1
   Else
      CONTA = CONTA + 1
   End If

This looks to see if the variable is null. If TRUE, it will set the variable to 1, else it will add 1 to the existing variable value.

CharlieRB

Posted 2016-03-18T13:15:25.423

Reputation: 21 303

Select Case Me!DtResposta If IsNull(Me!DtResposta) Then SemResp = SemResp + 1 End If Case Is <= Me!DtLimite DentroPrazo = DentroPrazo + 1 Case Is > Me!DtLimite ForaPrazo = ForaPrazo + 1 End Select – Emanuel – 2016-03-18T16:55:21.920

Did that work? What is your comment supposed to tell me? – CharlieRB – 2016-03-18T17:33:28.783