By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,189 Members | 1,028 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,189 IT Pros & Developers. It's quick & easy.

Invalid Use of Null

P: 35

I am getting error as Run-Time Error '94' Invalid Use of Null on my code
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport strReportName, ReportView, , strReportFilter, acWindowNormal
What should I do?
Oct 1 '18 #1
Share this Question
Share on Google+
2 Replies

P: 92
Without knowing anything about your report, it seems your filter variable, “strReportFilter” is Null. Do you know how to check it?

Usually you could simply wrap you variable in the Nz() Function to avoid the errror: Nz(strReportVariable,””). But in you case, this would only open a blank report.

I would recommend some code that checked for the Null value and then alerted the user that there was no data to report. Some thing like:

Expand|Select|Wrap|Line Numbers
  1. IF IsNull(strReportFilter) Then
  2.      MsgBoxd “No Data To Report”
  3. Else
  4.      DoCmd.Open.....
  5. End If
Oct 1 '18 #2

Expert Mod 2.5K+
P: 3,284
I also believe this error is related to your previous thread. Your filter could have a series of variables and parameters, and if only one null value is used incorrectly, you will get an invalid use of Null error. This could also be related to your underlying record source for the report. If there is an invalid use of Null there, you will also get the error. Does the report open properly without the filter?

We cannot solve this problem until 1) we see how you are creating your filter string and 2) we see the underlying query/record source for the report.
Oct 1 '18 #3

Post your reply

Sign in to post your reply or Sign up for a free account.