Results 1 to 5 of 5

Thread: IsNull on open

  1. #1
    Join Date
    Oct 2013
    Posts
    20

    Cool Unanswered: IsNull on open

    I have a database that uses to different fields to link to folders outside the database. I need a on database open function to check for empty fields in both cases and give a msgBox based on whether both need information or either or need information. Any help would be appreciated.
    Ken

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Code:
    If Nz(Me.ControlName.Value, "") = "" Then
        MsgBox ...
    Else
        ...
    End If
    Have a nice day!

  3. #3
    Join Date
    Oct 2013
    Posts
    20

    Thats for one field

    What if you have 2 fields that need to be evaluated for null on open.

  4. #4
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Quote Originally Posted by statman View Post
    What if you have 2 fields that need to be evaluated for null on open.
    You evalute them. Depending of what you want to do:
    Code:
    If Nz(Me.ControlName1.Value, "") = "" Or Nz(Me.ControlName2.Value, "") = "" Then ...
    Or:
    Code:
    If Nz(Me.ControlName1.Value, "") = "" And Nz(Me.ControlName2.Value, "") = "" Then ...
    Or:
    Code:
    If Nz(Me.ControlName1.Value, "") = "" Then
        ...
    Else If Nz(Me.ControlName2.Value, "") = "" Then
        ...
    Else
        ...
    End If
    Have a nice day!

  5. #5
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Sinndho has given you examples of validation code for checking for empty Fields, but I think you really need to give us more details of exactly what you're doing here.

    The OnOpen event, as a rule, is too early to do anything involving data; the OnLoad event is more appropriate, but even that would only be appropriate if your Form only contains one Record; is that the case, here?

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

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