Results 1 to 4 of 4
  1. #1
    AccessHelp23 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2023
    Posts
    2

    How to debug docmd.openquery

    Hello.



    I have a statement docmd.openquery that displays a Table successfully every time except a few times. I see an error runtime error 94- invalid use of null. I know this is due to using a null where a value is expected . So how do I proceed to debug this access query ? I am unable to step in to the queury but I know which query is returning the error.

    How do I proceed to debug this?

  2. #2
    AccessHelp23 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2023
    Posts
    2
    I mean how do I know which table and column are returning the null and causing the runtime error .

  3. #3
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,861
    A little hard really.
    How big is the query? You could get the sql and then inspect each of the fields in the immediate window perhaps?

    I'd just surround them with NZ() and a suitable value, or do it one by one until you find the errant field. Might be more than one really.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  4. #4
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,001
    A simple select query won't give you an error with a null value. What will is the use of a function that doesn't accept a null value as a valid input.

    So I would check all your function calls in the query as that will probably be the culprit.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 06-25-2020, 12:15 PM
  2. DoCmd.OpenQuery really necessary?
    By Bleekscheetje in forum Programming
    Replies: 3
    Last Post: 09-05-2015, 08:44 AM
  3. DoCmd.OpenQuery with Parameters?
    By mwhcrew in forum Queries
    Replies: 5
    Last Post: 10-10-2014, 01:49 AM
  4. docmd.OpenQuery produces error 2001
    By ultimateguy in forum Programming
    Replies: 4
    Last Post: 08-09-2014, 10:16 PM
  5. Replies: 3
    Last Post: 12-07-2012, 04:26 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums