[VB6 + Access] Recognizing table recovery using Ado or Adox
I created a small software that I have a copy of a database by clearing all the tables except for the system, the problem arises when it appears in the db table of Recovery :[Access] table recovery. Someone knows how to locate this table with Ado or Adox Or should I make to weep and to use force Dao (always in that case you can) ,I put the db in rapidshare if you want to test it surpasses the 500 KB maximum RapidShare: Easy Filehosting.This is the code that you can do the tests
Code:
Sub Main ()
'Fill in the references and Ado Adox
Dim cn As ADODB.Connection
Dim obj_Catalog As ADOX.Catalog
Dim obj_table As ADOX.Table
Set cn = New ADODB.Connection
cn.Open "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = C: \ NonCompattato.mdb"
Set obj_Catalog = New ADOX.Catalog
Set cn = obj_Catalog.ActiveConnection
For Each obj_table In obj_Catalog.Tables
If obj_table.Type = "TABLE" Then
MsgBox "Table Normal eliminable" & obj_table.Name
Else
MsgBox "Table does not eliminable" & obj_table.Name
End If
Next
cn.Close
Set cn = Nothing
Set obj_Catalog = Nothing
End Sub
Re: [VB6 + Access] Recognizing table recovery using Ado or Adox
There is no need to use ADOX to locate just use the method of the ADO connection OpenSchema. However, you can safely remove this
Code:
cn.execute "drop table <tablename>"
However I am not worried that much because when you compact the database automatically deleted.
Re: [VB6 + Access] Recognizing table recovery using Ado or Adox
You're right, I reread the question and I explained definitely wrong, I need to know how to recognize the scale of recovery in order not to run the query that the clear Because if no VB crashes, in effect, however, enclosing the table name in brackets this instruction.It works without making a turn, then the solution that you gave me solve the problem but I still curious to know how to recognize
Code:
Sub main ()
Dim cn As ADODB.Connection
As ADODB.Recordset Dim rs_Schema
As Long Dim i_iteratore
As String Dim s_String
Set cn = New ADODB.Connection
cn.CursorLocation = adUseClient
cn.Open "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = C: \ NonCompattato.mdb"
Set rs_Schema = cn.OpenSchema (adSchemaTables)
Do While Not (rs_Schema.EOF)
s_Stringa = ""
For i_iteratore = 0 To rs_Schema.Fields.Count - 1
s_Stringa = s_Stringa & rs_Schema (i_iteratore). Name & "=" & rs_Schema (i_iteratore). Value & "|"
Next
Debug.Print s_Stringa
rs_Schema.MoveNext
Loop
rs_Schema.Close
Set rs_Schema = Nothing
cn.Close
Set cn = Nothing
End Sub
Re: [VB6 + Access] Recognizing table recovery using Ado or Adox
To me it appears that the tables that start with the tilde (as in this case) are only temporary tables that Access has created, but not anything being done with the recovery of data. That table contains a single text field 'field1' and one record of the 'dr', which certainly does not justify the difference in size after you compact the database that has 10MB of only 240KB. With regard to the message, I have not received anything, at least I do not think. But I am pretty suspicious so if I see a sender that I do not know, not even exhaust the message (I always read the list from the server, then I decide whether to download or not).
Re: [VB6 + Access] Recognizing table recovery using Ado or Adox
In fact I did more testing and I have seen, for example, that if I create a new db three tables (with primary key) to delete after I open the table MSysObjects have magically appeared in three tables that start with the tilde.i close the db, it reopened without compacting and the three tables have vanished. Probably the table that I found in my db has remained there because of some crash.