Quick Question about query with no results

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Monroeski
    New Member
    • Aug 2007
    • 30

    Quick Question about query with no results

    I have a form that is based on a query that pulls names according to an input ID. If the ID is invalid, the query obviously returns no results. If this is the case, I want to make an error message visible, but I can't figure out how to determine this in the VBA code. Basically, it looks something like this -

    Code:
    If Me.Name = Null Then
            Me.TextBox1.visible = false
            Me.TextBox22.visible = True
    End If
    Only Null doesn't work, nor does "", and I've even tried If Me.Name = False. I feel stupid for asking such a simple question, but this is stumping me. How do I determine if it is blank or not?
  • puppydogbuddy
    Recognized Expert Top Contributor
    • May 2007
    • 1923

    #2
    Originally posted by Monroeski
    I have a form that is based on a query that pulls names according to an input ID. If the ID is invalid, the query obviously returns no results. If this is the case, I want to make an error message visible, but I can't figure out how to determine this in the VBA code. Basically, it looks something like this -

    Code:
    If Me.Name = Null Then
            Me.TextBox1.visible = false
            Me.TextBox22.visible = True
    End If
    Only Null doesn't work, nor does "", and I've even tried If Me.Name = False. I feel stupid for asking such a simple question, but this is stumping me. How do I determine if it is blank or not?
    Try this:
    Code:
    If IsNull(Me.Name) Then
            Me.TextBox1.visible = false
            Me.TextBox22.visible = True
    End If

    Comment

    • Monroeski
      New Member
      • Aug 2007
      • 30

      #3
      That worked, thanks for the help.

      Comment

      Working...