Results 1 to 6 of 6
  1. #1
    markjkubicki's Avatar
    markjkubicki is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    496

    deleting record leave at #Deleted

    I've got this simple code to delete a record... (which works just fine); the problem is navigating to a valid record once it is deleted.


    At first I did not have the me.requery line, and I thought that might help... but no


    Code:
                vCurrentRecordNo = Me.CurrentRecord            sSQL = "Delete from tbeFixtureTypeDetails" & " WHERE [Type] = '" & [Forms]![frmSpec]![txtType] & "';"
                CurrentDb().Execute sSQL, dbFailOnError
                Me.Requery
                
                If vCurrentRecordNo = 1 Then
                    DoCmd.GoToRecord , , acGoTo, 1
                Else
                    DoCmd.GoToRecord , , acGoTo, vCurrentRecordNo - 1
                End If
    as always, with many thanks in advance,
    Mark

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    If you are viewing this records through a Form, you might need a Me.Refresh line too, to refresh the Form to reflect the change.

  3. #3
    markjkubicki's Avatar
    markjkubicki is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    496
    I am viewing it thru a form<br>and took your suggestion to add ME.REFRESH (immediately after Me.Requery)<br>I've still got the #Deleted issue and get thrown an error: 'record is deleted' if I try to navigate away from it<br><br>running a debug, it goes to error immediately after the Me.Requery<br><br>

  4. #4
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    What kind of Form do you have?
    Is it showing a single record, continuous records?
    Is there a subform on it?
    How is the code being initiated?

    It may be helpful if you can upload the database for analysis. Just be sure to remove any sensitive information first.

  5. #5
    markjkubicki's Avatar
    markjkubicki is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    496
    - continuous records
    - with several related subforms
    - command button_click event
    don't mind uploading the database, but with several related files and and a lot of "other" (irrelevant) stuff, it will take a small bit of effort; never-the-less, if it becomes abvious that this would realy help my cause... just let me know (it's also still in 32-bit -which may certainly be a problem)

  6. #6
    Rawb is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Dec 2009
    Location
    Somewhere
    Posts
    875
    Try moving the Me.Requery down underneath the If block.

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

Similar Threads

  1. Replies: 2
    Last Post: 10-04-2014, 01:58 PM
  2. Replies: 2
    Last Post: 03-30-2012, 10:50 AM
  3. Record Sick Leave via access
    By Nixx1401 in forum Access
    Replies: 47
    Last Post: 09-07-2011, 05:59 AM
  4. Replies: 3
    Last Post: 07-27-2011, 02:07 PM
  5. record deleted
    By akram in forum Access
    Replies: 12
    Last Post: 03-11-2011, 09:23 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