Results 1 to 3 of 3
  1. #1
    mcomp72 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Posts
    92

    Form_Current code not working on my form

    I am trying to write code that greys out a couple of text boxes on one of my forms if certain conditions are not met. I wrote this for the Event OnCurrent for the form. This code isn't working, and I have no idea why.

    Code:
    Private Sub Form_Current()
    
    If Me.EmployeeNameComboBox = Null Then
    
        Me.BoxRentalAcctCode.Enabled = False
        Me.BoxRentalTotalAmt.Enabled = False
    
    End If
    
    End Sub
    When I run it, even when I am sure Me.EmployeeNameComboBox is, in fact, Null, it will not execute what is inside the IF statement. It acts as if the IF statement is false, even though it is true. I know this because I put a Watch on Me.EmployeeNameComboBox and I stepped through the code. Even when Me.EmployeeNameComboBox = Null, the code behaves as if that isn't true and skips over the lines inside the IF statement. See screenshot. If I press F8 to step into, it jumps down to End If.

    Click image for larger version. 

Name:	Current code not working.jpg 
Views:	9 
Size:	138.9 KB 
ID:	31224

    Any idea why this might happen?

    EmployeeNameComboBox is part two in a two-part cascading combo box set. I don't know if that matters, but thought I'd mention it.

  2. #2
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    See Post #5 in your other post https://www.accessforums.net/showthread.php?t=69076

    "Me.EmployeeNameComboBox = NULL" is ALWAYS False..

  3. #3
    mcomp72 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Posts
    92
    Ah... got it. Thanks, Steve. I hadn't seen your comment on the other thread yet.

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

Similar Threads

  1. form timer control code not working sometimes
    By trevor40 in forum Programming
    Replies: 2
    Last Post: 06-16-2016, 05:50 AM
  2. Replies: 1
    Last Post: 05-21-2013, 01:28 PM
  3. Login form code not working
    By dharmacloud in forum Forms
    Replies: 11
    Last Post: 08-22-2011, 03:08 PM
  4. Replies: 21
    Last Post: 02-14-2011, 02:51 PM
  5. Simple Nav Form Code Not Working
    By alsoto in forum Forms
    Replies: 10
    Last Post: 04-10-2009, 09:30 AM

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