Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2006
    Posts
    162

    Unanswered: vba if form field

    How would i write the vbs code for this.

    sub
    If Forms![Main].[Box Type] is null
    do this
    else if
    msg box Box Type must be selected.
    end sub

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Try IsNull(<yourvalue>) as opposed to If <yourvaue> Is Null

    I'm a big fan of using nz() to catch nefarious "empty" values that aren't technically null:

    If nz(<yourvalue>, "") = "" then
    ...
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Sep 2006
    Posts
    162
    Can you write that out so I understand how it is written.

    TIA

  4. #4
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    try A-help for
    nz()
    and/or
    isnull()

    by definition of NULL there is no entity
    entity &#231; NULL
    (where &#231; is any comparison operator you like)

    to make your life more difficult, there is no VBA comparison operator 'is'

    izy
    currently using SS 2008R2

  5. #5
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Yep. We're not doing VB or VB.NET here ...
    Back to Access ... ADO is not the way to go for speed ...

Posting Permissions

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