Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2007
    Posts
    10

    Null vs New Record

    Hello Smart People!



    This one is driving me nuts. After doing quite a bit of research, I cannot find the answer that I need, so I am posting...

    For a new record on frm1 I am trying to make the label (lblTest) for a text box named txtTest a certain color if a value has not been filled in. For some reason, I cannot get the code to work and I am guessing it is due to my lack of understanding of our good old friend NULL. Here is what in both the after update event for txtTest and the on current event for the form...

    If Me.txtTest = Null Then
    Me.lblTest.ForeColor = 255
    Me.lblTest.FontBold = True
    Else
    Me.lblTest.ForeColor = 0
    Me.lblTest.FontBold = False
    End If

    Why isn't the field red when I create a new record? Why is it that if I fill something into the field, then delete it, that it doesn't get bolded in red?

    Regards,
    James C.

  2. #2
    jya is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2007
    Location
    Chicagoland
    Posts
    109
    Instead of Me.txtTest = null, try

    IsNull(Me!txtTest)

    Not sure if it would matter, but you may want to add an OR statement and include IsEmpty check.

    Hope that helps.

  3. #3
    Join Date
    Oct 2007
    Posts
    10

    Thank you!

    It worked great. Thanks!

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

Similar Threads

  1. Replies: 4
    Last Post: 08-19-2011, 01:53 PM
  2. Fill in Null values
    By Petefured in forum Queries
    Replies: 1
    Last Post: 10-06-2008, 12:54 PM
  3. HELP with NULL DateTime VALUES
    By lfolger in forum Programming
    Replies: 3
    Last Post: 03-28-2008, 02:33 PM
  4. Replies: 0
    Last Post: 11-17-2006, 09:38 AM
  5. Null Values not showing up in a Query
    By Valli in forum Queries
    Replies: 0
    Last Post: 01-04-2006, 03:53 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