Run time error ‘94’ invalid use of null

Excelcurious23

New Member
Joined
Jul 11, 2023
Messages
6
Platform
  1. Windows
I see this error in the line docmd.openquery xyz

First question is how do I figure out which value is null ? The query xyz is a huge query. How do I see which value is nulll. This statement works for other situations except for maybe 1 out of 30 runs.

I’ve tried to import the tables involved in the query into another access database named them the same and Copied the same query and ram it and I got results !! So it is not a data issue

Help!!! Please advise on how to proceed and how to debug this !!

Usually hovering over a variable will tell us which value is nulll. But in this case all I know is the query name which has a null value but not which field in the query is null. !!
 
Exactly how many fields are in this query?
How hard is it to make a copy of the query, take away all the field except one, and then add them back in one at a time, checking after each one, so you can identify the offending field?
 
Upvote 0

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
:). There are 3 tables and 20 fields each.
Seems do-able.
If you really have no idea which field is the offending field, that is probably the best way to go.

Alternatively, you may want to open each table directly, and sort each field, one at a time, and check for any errors or odd looking data.

Most likely, you have some data that is wreaking havoc with one of your calculations, so the key is to find it.
I have given you multiple ways of doing that. Now it is up to you to do it.
 
Upvote 0

Forum statistics

Threads
1,223,239
Messages
6,170,947
Members
452,368
Latest member
jayp2104

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top