Results 1 to 2 of 2
  1. #1
    alsoto is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Apr 2009
    Posts
    67

    Trying to trigger an event if my cbo box control Is Null or ""

    Hello,



    I'm trying to trigger an event if the SSN combo box control in my form Is Null or "". It just won't work.

    I have attached an access file with the form and the underlying table which is the record source for the SSN combo box control. To demonstrate my problem, I have a text box which is filled by the after update event of the control with this code:

    Private Sub SSN_AfterUpdate()
    If Me.SSN = "" Or Null Then
    Me.test = "NULL"
    Else
    Me.test = "NOT NULL"
    End If
    End Sub

    When I choose a SSN from the combo box control, text box test is updated to "NOT NULL". When I clear the combo box, nothing happens. Text box test is not updated with "NULL".

    I apologize if this is something obvious, but I have wasted a couple of hours trying to figure it out and I am at my wit's end.

    Please help.

    Thanks in advance,
    Al

  2. #2
    alsoto is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Apr 2009
    Posts
    67
    This Worked:

    Private Sub SSN_AfterUpdate()

    If nz(SSN,"") = "" Then
    Me.test = "NULL"
    Else
    Me.test = "NOT NULL"
    End If

    End Sub

Please reply to this thread with any new information or opinions.

Similar Threads

  1. StrComp causing "Invalid use of Null" error
    By sephiroth2906 in forum Programming
    Replies: 5
    Last Post: 09-15-2011, 07:06 PM
  2. Update query from form "invalid use of null"
    By Lady_Jane in forum Programming
    Replies: 4
    Last Post: 08-16-2011, 01:37 PM
  3. Replies: 7
    Last Post: 01-19-2011, 10:39 AM
  4. Replies: 12
    Last Post: 06-14-2010, 08:39 PM
  5. Replies: 21
    Last Post: 06-03-2009, 05:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums