每次日期字段为空时,如何向变量添加一个值?


0

在Access 2013中,我正在编写报告。使用 On print event,每次日期字段为空时,我都会尝试向变量添加一个值。它工作正常 somaValores =Somavalores + 1

试着 IIF 但它不起作用。 有任何想法吗?

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

Answers:


0

我无法测试这个,但我认为你在寻找 ISNULL 在你的 Case

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

这样可以查看变量是否为null。如果为TRUE,则将变量设置为 1,否则它会添加 1 到现有的变量值。


选择Case Me!DtResposta If IsNull(Me!DtResposta)然后SemResp = SemResp + 1 End如果Case是< = Me!DtLimite DentroPrazo = DentroPrazo + 1 Case is>我!DtLimite ForaPrazo = ForaPrazo + 1 End Select
Emanuel

那有用吗?你的评论应该告诉我什么?
CharlieRB
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.