From: Access SS on 24 Feb 2010 16:24 I deleted a table out of my database... i know need it back. I still have the database open, is there anyway to get the table back? -- Access SS
From: Dirk Goldgar on 24 Feb 2010 16:50 "Access SS" <AccessSS(a)discussions.microsoft.com> wrote in message news:2151550F-959C-41CA-9433-DC72A3C2E2B5(a)microsoft.com... >I deleted a table out of my database... i know need it back. I still have > the database open, is there anyway to get the table back? If you haven't compacted or done anything else, this might work: '------ start of code ------ Function UndeleteTable() Dim db As DAO.Database, strTableName As String Dim i As Integer, StrSqlString As String Set db = CurrentDb() For i = 0 To db.TableDefs.Count - 1 If Left(db.TableDefs(i).Name, 4) = "~tmp" Then strTableName = db.TableDefs(i).Name StrSqlString = "SELECT DISTINCTROW [" & strTableName & _ "].* INTO MyUndeletedTable FROM [" & strTableName & "];" DoCmd.SetWarnings False DoCmd.RunSQL StrSqlString DoCmd.SetWarnings True MsgBox "A table has been restored as MyUndeletedTable", _ vbOKOnly, "Restored" GoTo Exit_UndeleteTable End If Next i MsgBox "No Recoverable Tables Found", vbOKOnly, "Not Found" Exit_UndeleteTable: Set db = Nothing Exit Function Err_UndeleteTable: MsgBox Err.Description Resume Exit_UndeleteTable End Function '------ end of code ------ You would paste that code into a standard module, and then either invoke it via F5 or enter this in the Immediate Window: UndeleteTable -- Dirk Goldgar, MS Access MVP Access tips: www.datagnostics.com/tips.html (please reply to the newsgroup)
From: Maurice on 24 Feb 2010 16:53 Nope, backup has to do the trick. That's why you are asked for confirmation before the table is deleted. Sorry... maybe someone does know a nifty trick somehow. -- Maurice Ausum "Access SS" wrote: > I deleted a table out of my database... i know need it back. I still have > the database open, is there anyway to get the table back? > -- > Access SS
From: a a r o n . k e m p f on 24 Feb 2010 18:36 SQL Server could allow you restore up until right before this happened. with Access, you're stuck with the backup copy from last night On Feb 24, 1:53 pm, Maurice <Maur...(a)discussions.microsoft.com> wrote: > Nope, backup has to do the trick. That's why you are asked for confirmation > before the table is deleted. > > Sorry... maybe someone does know a nifty trick somehow. > -- > Maurice Ausum > > > > "Access SS" wrote: > > I deleted a table out of my database... i know need it back. I still have > > the database open, is there anyway to get the table back? > > -- > > Access SS
From: Larry Linson on 25 Feb 2010 01:14
"a a r o n . k e m p f @ g m a i l . c o m" <aaron.kempf(a)gmail.com> wrote > SQL Server could allow you restore up until > right before this happened. That is why SQL Server, in one of its several editions, is often used as the database with an Access frontend in one of three versions: MDB, ACCDB, or ADP. > with Access, you're stuck with the backup copy from last night A solution which might work to recover the deleted table has been posted. If that works, it's moot when the backup copy was made. There is no required schedule for making backup copies, so Mr. Kempf's statement should read "the most recent backup copy" (and should state, "if that is required"). Larry Linson Microsoft Office Access MVP |