运行时错误'94'无效使用null - 在Access 2013下 [英] run-time error '94' invalid use of null - under Access 2013

查看:591
本文介绍了运行时错误'94'无效使用null - 在Access 2013下的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为最近的月预测添加了两个新月后出现此错误。


点击调试后,下面显示:


Private Sub Form_Load()

    'Dim rsPeriod As DAO.Recordset

    'set rsPeriod = CurrentDb.OpenRecordset(" Perioddate"))
    'Me.Period_Date = Me.Period_Date。(0)

    Set_global_variable_strPeriodLA"'" &安培; Me.Period_Date.ItemData(0)& "'"

    Set_global_variable_strPeriod"'" &安培; Me.Period_Date.Column(0)& "'"

    strCurPeriod = Me.Period_Date.ItemData(0)

    strPrevPeriod = Me.Period_Date.ItemData(1)

 'Set rs = CurrentDb.OpenRecordset(s)



句子:  strCurPeriod = Me.Period_Date.ItemData(0) 是高亮黄色。


应该是什么我是为了解决这个错误吗?



非常感谢!

解决方案

Hi Stella,


根据错误消息,我猜测Me.Period_Date.ItemData(0)的值为Null,这意味着没有选择任何内容用户。如果是这样,您可以先检查它,或者使用Nz()函数在空或Null时指定默认值。


希望它有帮助......


I have this error after add two new month for recent for month forecasting.

after i click debug, the below showed up:

Private Sub Form_Load()
    ' Dim rsPeriod As DAO.Recordset
    ' Set rsPeriod = CurrentDb.OpenRecordset("Perioddate")
    ' Me.Period_Date = Me.Period_Date.(0)
   Set_global_variable_strPeriodLA "'" & Me.Period_Date.ItemData(0) & "'"
   Set_global_variable_strPeriod "'" & Me.Period_Date.Column(0) & "'"
   strCurPeriod = Me.Period_Date.ItemData(0)
   strPrevPeriod = Me.Period_Date.ItemData(1)
 'Set rs = CurrentDb.OpenRecordset(s)

the sentence: strCurPeriod = Me.Period_Date.ItemData(0)  is in hightlight yellow.

what should i do to solve the error?

Much appreciated!

解决方案

Hi Stella,

Based on the error message, I am guessing the value of Me.Period_Date.ItemData(0) is Null, which means nothing was selected by the user. If so, you can either check for it first or use the Nz() function to assign a default value when it is empty or Null.

Hope it helps...


这篇关于运行时错误'94'无效使用null - 在Access 2013下的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆