Textbox #Error in a form coming from a Query that has not run yet.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • IStogias
    New Member
    • Aug 2024
    • 1

    Textbox #Error in a form coming from a Query that has not run yet.

    Hi All

    Relatively new to Access.
    I have a DLook up textbox getting a value from a query.
    When i am running the query, textbox works fine and returns/display the exact values i am after.
    But upon opening the form, I am getting #Error on the textbox until I run the query.

    Is there a way when I open the form to dismiss this #Error showing in the textbox?
  • noahwill
    • Oct 2025
    • 0

    #2
    You’re seeing that error because the form is trying to display the DLookup value before the query it depends on has actually run. One easy workaround is to add an Nz() or IIf(IsError()) wrapper around your DLookup, so Access shows something blank or default instead of the error.
    slope

    Comment

    • jeffreestar
      New Member
      • Nov 2025
      • 2

      #3
      great that error because the form is trying to display the DLookup value before the query it depends on has actually run. One easy workaround is to add an Nz() or IIf(IsError())

      Comment

      • splitintrigue
        New Member
        • Jan 2026
        • 2

        #4
        That usually happens because the form loads before the query has any data to return, so the DLookup evaluates to an error. You can avoid showing error by wrapping the DLookup in Nz() or an IIf() check, for example returning an empty string or 0 when nothing is found. Another option is to refresh or requery the form (or control) in the form’s On Load or On Current event so the query runs before the textbox is evaluated.

        Comment

        • kaleemjaan
          New Member
          • Nov 2025
          • 10

          #5
          This usually happens when the form loads before the query returns a value. You can handle it by using functions like Nz() or by checking for Null values in the textbox control source. For example, using something like =Nz(DLookup(... ), "") can prevent the #Error from appearing when the query hasn’t run yet.

          Also make sure the query or required data is loaded in the Form_Load or Form_Current event so the control has a valid value to display.

          By the way, while searching for different tools and resources online, I also came across a site related to the game Chicken Gun where you can скачать читы на chicken gun and find more information about the game.
          zz0.a67p2q0r55b zz
          Скачайте мод-меню чикен ган v5.3.02 с читами, режимом бога, бесконечными деньгами и приватными серверами для Android в 2026 году.

          Comment

          Working...