Page 1 of 2 12 LastLast
Results 1 to 15 of 26
  1. #1
    Mac R is offline Advanced Beginner
    Windows 7 64bit Access 2013 64bit
    Join Date
    May 2022
    Location
    Maine, USA
    Posts
    39

    Recover a Deleted Form

    Unbelievably stupid on my part... I am about 99.9% sure I know the answer to this, but I thought I might as well ask...



    This morning, I am merrily coding away on a form that does the lion's share of the work for the app I'm developing. There is a lot wrapped around this form. In code, I do a lot of record adds and deletes depending on what the user wants to accomplish. In the code, whilst this record manipulation is being done, I turn off warnings so the user does not see the append, update or delete messages from Access. If my code 'breaks' there is always the possibility that Warning are OFF after the break. That happened to me this morning, and I did the fix, exited the debugger, closed and saved the form, then right clicked on it to open it again in design and inadvertently clicked on delete. *POOF* - form is gone. My backup is about 12 hours old, and missing two days worth of modifications.

    Y'know my question... I still have Acc2013 open... I have not closed the dB. Is there anyway to recover the form?

  2. #2
    Mac R is offline Advanced Beginner
    Windows 7 64bit Access 2013 64bit
    Join Date
    May 2022
    Location
    Maine, USA
    Posts
    39
    I've been surfing, and found this in a post on this forum where someone deleted a table and used this function to recover it (I ass-u-me). I'm not finding something similar to this with respect to a FORM, but maybe someone out there knows?

    https://docs.microsoft.com/en-us/off...rom-a-database

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,725
    Mac R,

    I tried the recoverTable code you pointed to and it worked fine.
    I have had no luck finding a recoverForm.
    I have copied a form, renamed it, deleted it and then looped thru all forms trying to find 1 with name "~tmp" or just "~" but get nothing. Not sure how a deleted (but not purged) form is identified.

  4. #4
    Mac R is offline Advanced Beginner
    Windows 7 64bit Access 2013 64bit
    Join Date
    May 2022
    Location
    Maine, USA
    Posts
    39
    Orange,

    Much appreciated... <<sigh>> I might just have to re-create about 5 hours of work... Luckily, a lot of it deals with opening additional forms which are NOT deleted, and uses new fields from related tables which are also intact, so now all I have to do is try and remember my logic stream on getting to where I was. As stated... I know better than not to back up prior to modification, but for some reason I didn't get it done this ayem... My bad entirely. Thanks for your efforts...

  5. #5
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    Deleted tables can indeed be recovered whilst the database is still open and hasn't been compacted.
    However, normally its not possible to recover forms unless you can see an item in the VBE listed as Form_~TMPCLP....
    If so, it MAY be possible by modifying methods used in this article Removed deleted objects (isladogs.co.uk)
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  6. #6
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,725
    Mac R,
    When I delete the copy I made, the warning message says if you delete the form, it can not be recovered.
    You can SaveAsText and restore a form, but of course --once it is deleted,it's too late.
    Probably better to save your work frequently; backup regularly...
    But we've all been bitten to one degree or another.

    Good luck.

  7. #7
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,428
    No idea if the following will work

    you can do a search of msysObjects to see if it is still there in some form - code along the lines

    SELECT *
    FROM msysObjects
    WHERE [Type]=-32768 and [Name] like '*' & [Enter form name] & '*'

    if you see your form name there - perhaps with a ~ prefix or similar, copy the name in full then in the vba immediate window type

    ?docmd.OpenForm "",acDesign

    and paste the form name between the double quotes

    then press return

    with a bit of luck you will get your form back.

    Edit - so similar to Colin's suggestion but looks like you need to modify the sql above to look for '~TMPCLP*'

  8. #8
    Mac R is offline Advanced Beginner
    Windows 7 64bit Access 2013 64bit
    Join Date
    May 2022
    Location
    Maine, USA
    Posts
    39
    Hey Isladogs...

    Nope... sadly NO ~TMPCLP listed in the forms collection or in MSysObjects anywhere... there are references to the form name (sort of), but none with a TMPCLP associated to the name.

    Thanks for the effort...

  9. #9
    Mac R is offline Advanced Beginner
    Windows 7 64bit Access 2013 64bit
    Join Date
    May 2022
    Location
    Maine, USA
    Posts
    39
    Appreciate the effort and time, Ajax...

    Form Name: f_recipes_single_item_display

    Select Query Used:
    SELECT MSysObjects.Name, MSysObjects.Type
    FROM MSysObjects
    WHERE MSysObjects.Name Like '~TMPCLP*'
    ORDER BY MSysObjects.Name;

    Sadly, the output to the select query you provided doesn't produce anything with that form name in it. Here is all it produces...

    Click image for larger version. 

Name:	MSysObject Query.JPG 
Views:	25 
Size:	17.1 KB 
ID:	48050

    I modified the query to
    SELECT MSysObjects.Name, MSysObjects.Type
    FROM MSysObjects
    WHERE MSysObjects.Name Like '*recipe_single_item_display*'
    ORDER BY MSysObjects.Name;

    to see if anything interesting popped up, and got...

    Click image for larger version. 

Name:	MSysObject Query 2.JPG 
Views:	24 
Size:	45.5 KB 
ID:	48051

    but these look like references to controls on the form, not the form itself.

    Walking down a path with no end I fear...

    Thanks,

  10. #10
    Mac R is offline Advanced Beginner
    Windows 7 64bit Access 2013 64bit
    Join Date
    May 2022
    Location
    Maine, USA
    Posts
    39
    Thanks, Orange... yeah, bitten! :^0

  11. #11
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,725
    Ajax,

    I tried your suggestion. When I did the copy and rename, I can see the form name in the MSysObjects. But when I delete the form, the MSysObjects record shows up immediately as DELETED. I did not see any temp type name.

  12. #12
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,428
    wasn't sure it would work

    but these look like references to controls on the form
    they are - sql to listbox, combo and subform row/recordsource. But you wouldn't edit them as a query, only through the form

  13. #13
    Mac R is offline Advanced Beginner
    Windows 7 64bit Access 2013 64bit
    Join Date
    May 2022
    Location
    Maine, USA
    Posts
    39

    A Lesson Learned

    ALL~

    I think I'm at the end of my search here and the only course of action left to me is importing the form from the backup I have, and re-doing the stuff lost between yesterday and today.

    A lesson learned (yet again). BACK UP FREQUENTLY!!!!!!

    This is a great place, and I really appreciate the effort everyone put forth trying to solve my issue. I hope I can help someone here, someday.

    Thanks again!

  14. #14
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,800
    I think that the real lessons to be learned here are
    - don't turn off warnings; learn to use Execute method
    - if you must turn off warnings, you MUST have an error handler that will turn them back on.
    - to a lesser degree, one could open the form first then switch views as there is no delete choice on the view menu.

    What seems interesting is how you could accidentally choose delete because in my version, delete is near the bottom of the menu while the views are near the top.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  15. #15
    Mac R is offline Advanced Beginner
    Windows 7 64bit Access 2013 64bit
    Join Date
    May 2022
    Location
    Maine, USA
    Posts
    39
    Hey Micron...

    I am unclear what you are referring to re: the Execute Method. Can you enlighten, or point me in a direction?

    re: error handler, agreed. pobody's nerfect... and I proved it this morning. I constantly have to tell myself to slow down, and do it right.

    As for position, you're guess is as good as mine, all I remember is a flash and the form was gone... maybe I clicked, held and dragged for a micro-second. I dunno...

    Click image for larger version. 

Name:	Design versus Delete position.JPG 
Views:	18 
Size:	38.5 KB 
ID:	48053

    But thanks for the insight.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Recover deleted table in MS Access 2013
    By metsmaniac in forum Access
    Replies: 1
    Last Post: 10-10-2017, 12:44 PM
  2. Recover a seemingly corrupted form
    By GraeagleBill in forum Forms
    Replies: 13
    Last Post: 08-21-2014, 06:40 PM
  3. delete query produce #deleted in all deleted values
    By learning_graccess in forum Queries
    Replies: 2
    Last Post: 03-31-2012, 07:20 AM
  4. Serious Access Error, How to Recover?
    By bigroo in forum Access
    Replies: 4
    Last Post: 02-04-2012, 03:35 PM
  5. recover database
    By jgales in forum Access
    Replies: 1
    Last Post: 10-28-2011, 08:53 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