|
From: Ross K. <ros...@gm...> - 2014-01-04 21:04:33
|
Hi Tony, Thanks for the reply, I managed to find it. Here are the details for a MDB-2000 file format: There is a system table called MSysAccessObjects. This table has an ID field (autoincrement) and a Data field (binary data). All the binary data is of a fixed length (3992 bytes from memory). The first entry (ID=0) appears to be some sort of header but the rest of the Data fields contain an OLE Compound file similar to what was used in the legacy Office file formats. So if you concatenate the Data fields in ID order for ID>0 and write to a file you can extract the VBA contents amongst other information. You can inspect the file contents using 7zip. Here is the VB.net code I used to extract the information: Sub Main() Const Sql As String = "Select * from MSysAccessObjects where ID > 0 order by ID ASC;" Const DatabasePath As String = "c:\users\ross\desktop\Copy 1st Mech JobCosting.mdb" Const OutputFilePath As String = "c:\users\ross\desktop\compoundfile" Using conn As New OleDbConnection() With New OleDbConnectionStringBuilder() .DataSource = DatabasePath .Provider = "Microsoft.ACE.OLEDB.12.0" conn.ConnectionString = .ConnectionString End With conn.Open() Dim table As New DataTable Using adapter As New OleDbDataAdapter() adapter.SelectCommand = New OleDbCommand(Sql, conn) adapter.Fill(table) End Using conn.Close() Using writer As New BinaryWriter(New FileStream(OutputFilePath, FileMode.Create, FileAccess.Write)) For Each row As DataRow In table.Rows writer.Write(row.Item("Data")) Next row writer.Close() End Using End Using End Sub On Sat, Jan 4, 2014 at 2:52 PM, Tony Toews <to...@gr...> wrote: > At 06:34 PM 2014-01-03, Ross Knudsen wrote: > > I see on the TODO list that there is a task to extract the VBA code from > the database. I'm quite keen on giving this a go but I wanted to know > where in the database it is actually stored? Is it a record in a table > somewhere? > > > I have a vague memory that, starting in Access 2000, all VBA code was > placed in a BLOB/Memo field in one record. I'm not at all sure if > compiled VBA code was placed in the same BLOB. That said the code won't > be that useful without the forms and reports. > > Tony > > ----- > Tony Toews, Microsoft Access MVP > Tony's Main Microsoft Access pages - http://www.granite.ab.ca/accsmstr.htm > Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/ > Granite Fleet Manager http://www.granitefleet.com/ > |