Error 2467:Object closed or doesnt exist

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • roeti
    New Member
    • Oct 2017
    • 3

    Error 2467:Object closed or doesnt exist

    Hello there I am having the above error and need assistance promptly please, I am trying to create an activity log table which logs the activities of users within my database, it seems to be working but having an issue of cannot populating the user details in the log table saying the above error mentioned.

    Here is my current script below, I know that it is a minor error but cant seem to get around it :(



    Private Sub ok_Click()
    txtUsername.Set Focus

    If txtUsername = "user" And txtPassword = "Testing123 " Then
    MsgBox "Access Granted", vbInformation, "Test"
    DoCmd.Close
    DoCmd.openform "Main Menu"

    Else

    MsgBox "ERROR: Please check your login details and try again."

    End If

    TempVars("UserN ame").Value = Me.txtUsername. Value
  • MikeTheBike
    Recognized Expert Contributor
    • Jun 2007
    • 640

    #2
    Hi

    I would hazard a guess that you need to put this statement
    Code:
    TempVars("UserName").Value = Me.txtUsername.Value
    before DoCmd.Close !!??

    MTB

    Comment

    • PhilOfWalton
      Recognized Expert Top Contributor
      • Mar 2016
      • 1430

      #3
      I believe your problem may be you don't say what you want to close.

      Try
      Code:
          DoCmd.Close acForm, Me.Name
      Phil

      Comment

      • roeti
        New Member
        • Oct 2017
        • 3

        #4
        Thank you Mike and Phil for your kind assistance. I did what you both advised and worked perfectly by putting the TempVars("UserN ame").Value = Me.txtUsername. Value in front of the DoCmd.Close statement and also added acForm, Me.Name next to DoCmd.Close statement. THANKS HEAPS !!!

        Comment

        Working...