Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2011
    Posts
    48

    Unanswered: Stopping a macro when a field is null

    I have a macro, that runs a bunch of queries and updates data. I want a query to run first, and if a certain field anywhere in the data is NULL, have the macro stop and make the user update it. If nothing is NULL then the macro will keep on running. Is this possible?

  2. #2
    Join Date
    Sep 2011
    Posts
    48
    I am still new at access and just realized this probably can't happen.

    But is there code (written in the module) that can check it, so that if the column in the table is null it gives an error and stops the macro?

  3. #3
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Yes it's easier using VBA:
    Code:
    If DCOUNT("*", "[Some_Table_Or_Query]", "[A_Certain_Field] Is Null") > 0 Then
        ' Nulls found: Don't run the Macro and have the user to update first.
    Else
        ' No Nulls found: Run the macro.
    End If
    Have a nice day!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •