Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4332582
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T10:16:36+00:00 2026-05-21T10:16:36+00:00

I have a textbox and a button on my Access form. In the click

  • 0

I have a textbox and a button on my Access form. In the click event of the button i want to see if the textbox is empty, if it is, nothing will be executed.
So i use

If Me.textbox.Value = Null Then
    Exit Sub
End if

But it doesn’t work… I checked the textbox.value in the execution window and it is Null, but the if clause just doesn’t work… Why?

EDIT: @Dimse, I tried “”, doesn’t work. And also textbox.text = Null, it pops an error telling me the textbox is not active.. Very strange.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T10:16:37+00:00Added an answer on May 21, 2026 at 10:16 am

    Null is never equal to anything, not even Null. Use the IsNull() function.

    If IsNull(Me.textbox.Value) Then
    

    If you want Me.textbox treated the same when it contains an empty string as when it’s Null, concatenate an empty string to it and check the length of the combined string:

    If Len(Me.textbox.Value & "") = 0 Then
    

    You could also use the named constant, vbNullString, instead of the string literal, "", for an empty string.

    If Len(Me.textbox.Value & vbNullString) = 0 Then
    

    Using the string literal requires VBA to construct that string from scratch each time. With the named constant, VBA only needs to reference it, so should be faster and use less memory. However in many (probably most) cases, the performance advantage with vbNullString would be so minor that you wouldn’t notice the difference. Also see the comment below from David-W-Fenton.

    For me, the more compelling reason to use vbNullString is that it’s instantly recognizable to my aging eyes. Conversely, with the string literal, it takes (a tiny bit) longer for me to confirm that "" is not actually something else … like " " or "'". The only downside with vbNullString, IMO, is that requires more typing than "".

    And finally, although you don’t actually need to explicitly reference the Value property (since it’s the default property of a text box), I left it in because you had it that way and because I prefer to be explicit with Value, too. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a TextBox control on my Form. I use the Leave event on
I have a form with a textbox and a button. IE is the only
So I am trying to use a button click to open the next form
I have a textbox and a button on a form. I wish to run
I have a text box and a button in a form.i want to save
Here's the scenario: I have a textbox and a button on a web page.
I have a textbox and a link button. When I write some text, select
I have UserControl which contains a TextBox and a Button control. The Button opens
I have a textbox with an onchange event. Why does this event not fire
I have a bunch of controls (textbox and combobox) on a form with toolstripcontainer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.