Results 1 to 3 of 3
  1. #1
    dniezby is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Apr 2013
    Posts
    183

    Expression refers to an object that is closed...WTF?

    Okay, so I'm using code I've used a GAZILLION TIMES. What the heck is going on? I keep getting an error that says,



    "The expression you entered refers to object that is closed or doesn't exist." Runtime error 2467

    Here is the code:

    If Not Me.NewRecord Then
    Me.ModifiedDate = Now()
    End If



    ModifiedDate isn't a reserved word is it?

    I have used this code forever. On my form I have a control named ModifiedDate that gets updated when there is a modification to the data is not a new record. It is also disabled for user access so they can't change or edit it, but it has never affected code updates before.

    Can't explain why it's causing this problem.

    Any thoughts?

  2. #2
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,474
    Where are you running the code, if in OnOpen try OnLoad instead.

  3. #3
    dniezby is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Apr 2013
    Posts
    183

    Expression refers to an object that is closed...WTF?

    Quote Originally Posted by Bulzie View Post
    Where are you running the code, if in OnOpen try OnLoad instead.
    Opps sorry, there is all of the code there. It ALL exists too.

    Private Sub Form_BeforeUpdate(Cancel As Integer)
    'If the updates are not a new record, update the ModifiedDate control.
    If Not Me.NewRecord Then
    Me.ModifiedDate = Now()
    End If

    'If SBC ID is blank, post a message box error.
    If IsNull([SBCUsername]) Then
    MsgBox "You MUST have a User ID to continue."
    End If

    End Sub

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

Similar Threads

  1. Replies: 2
    Last Post: 03-13-2015, 09:11 AM
  2. Replies: 7
    Last Post: 06-30-2014, 07:44 AM
  3. Replies: 4
    Last Post: 08-17-2011, 05:30 AM
  4. IIF In Query that refers to other field names
    By JohnBoy in forum Queries
    Replies: 2
    Last Post: 06-18-2010, 11:41 PM
  5. Replies: 3
    Last Post: 11-22-2009, 07:46 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