Results 1 to 4 of 4
  1. #1
    geraldk is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Dec 2011
    Posts
    49

    error 424 - oject required

    Getting error in this code when I am deleting a record in a table:
    Code:
    'getting temp values
    Dim Matrixtempvalue As Double
    
    If Me.txtMatrixID = 1 Then
       Martixtempvalue = Me.txtMatrixID + 1
    Else
       Matrixtempvalue = Me.txtMatrixID - 1
    End If
    
    MsgBox "Are you sure you like to delete this record?", vbYesNo, "Deleting Record"
    
    If vbYes Then
       Call Me.editform 'unlocks text boxes
       DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70 'it errors out here.
       DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
       MsgBox "Record Deleted", vbInformation
       Call Me.noneditform 'locks text boxes
    
       Dim Martrs As Object
       Set Martrs = Me.Recordset.Clone
       Martrs.FindFirst "[MatrixID] = " & str(Matrixtempvalue)
       Me.Bookmark = Matrixrs.Bookmark
    Else
       MsgBox "Nothing Deleted"
    End If
    
    Me.Form.RecordSource = "SELECT tblMatrix.MatrixID, tblMatrix.EmpID, tblMatrix.TrainMatrixID, tblMatrix.LegendID, tblMatrix.MatrixDate " _
    & " FROM tblMatrix " _
    & " WHERE (((tblMatrix.EmpID)=[forms]![frmEmployee]![txtEMPID]));"
    Me.Form.Requery
    Me.lstMatrixTrain.Requery
    
    DoCmd.SetWarnings True

    Last edited by June7; 04-05-2012 at 12:31 PM. Reason: Mod Edit: add code tags and indentation

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    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.

  3. #3
    geraldk is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Dec 2011
    Posts
    49
    I have this same code in another form to delete a record and it works. I compare to what I have in the other form and they are the same.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    Don't know, never use DoMenuItem, I use RunCommand.

    Try it, if it fixes issue, regardless of the other form's success, keep it, if not then reveals something worse is wrong with code. Seems like VBA doesn't recognize a record is selected and maybe for some reason it isn't. Step debug, follow code as it executes, maybe you can see what goes wrong.
    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.

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

Similar Threads

  1. Replies: 3
    Last Post: 07-23-2011, 08:34 AM
  2. Error: Object Required
    By compooper in forum Programming
    Replies: 6
    Last Post: 06-22-2011, 07:52 AM
  3. Object Required Error.
    By Robeen in forum Forms
    Replies: 1
    Last Post: 03-28-2011, 10:30 AM
  4. Run-time error '424': Object required
    By cowboy in forum Programming
    Replies: 18
    Last Post: 07-07-2010, 03:32 PM
  5. immediate help required
    By pdurgi in forum Access
    Replies: 1
    Last Post: 06-05-2009, 08:21 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