Results 1 to 8 of 8
  1. #1
    dexterwolf is offline Novice
    Windows XP Access 2003
    Join Date
    Dec 2015
    Posts
    2

    Handling Run-time error '2427': You entered an expression that has no value

    I get the title message and then asks to Debug. I debug and the second line is highlighted below. Anyone have any ideas as this has just stopped working in Access 2003. Thanks for any help



    Private Sub ObjName_Enter()
    If Me.code = "" Or IsNull(Me.code) Then
    Me.ObjName.Locked = True


    Else
    Me.ObjName.Locked = False
    End If
    End Sub

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    I believe code is a reserved word. Do you have a control or a field in a table with the name, "code"?

  3. #3
    dexterwolf is offline Novice
    Windows XP Access 2003
    Join Date
    Dec 2015
    Posts
    2
    Thanks for coming back to me.

    In the data view the only thing I have with code is Church Code.

  4. #4
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    So what you need then is something like this:

    If Me![church code] = "" Or IsNull(Me![church code]) Then ...

    Note that I changed Me. to Me! to refer to the form control. Most of the time using Me. (with the period) works, but there are times when you have to use Me! (with the !); it is good practice to always use the ! when referring to form controls or recordset members.

    If "Church Code" is not the name of a form control, but it is a field in the form's underlying data, then just use [Church Code], without the Me.

  5. #5
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    I always thought it was the opposite. That using Me with the bang was accessing the Field within the form's recordset and the dot operator is best used for accessing members other than the default member. So, use the dot access operator to access Controls.

    Me.ControlName and Me!FieldName

    .

  6. #6
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    A quick internet search on this shows that the general consensus is that ..... there isn't one.

    I try to use ! for form controls or recordset members, and dot for properties and methods. I have found as MS Access has evolved, it has gotten more and more fussy about which is used when - but maybe that's just me. (or is it just me!) ?

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    I use dot to invoke intellisense popup tips in VBA - controls will be listed. Use bang for recordset fields and when using classes, like: Forms!formname.controlname
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #8
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by John_G View Post
    A quick internet search on this shows that the general consensus is that ..... there isn't one.
    I definitely agree with that.

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

Similar Threads

  1. Replies: 2
    Last Post: 07-21-2014, 12:44 PM
  2. Replies: 11
    Last Post: 05-01-2014, 11:56 AM
  3. Replies: 3
    Last Post: 03-05-2013, 11:17 AM
  4. runtime error code 2427 expression with no value
    By snoopy in forum Programming
    Replies: 8
    Last Post: 06-10-2012, 11:07 PM
  5. Replies: 6
    Last Post: 05-30-2012, 12:32 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