Check for Specific Tables?

Ok,
been at it for 17 hours straight now, and I am starting to lose my ability to think.

How do I check my database file to see if ALL 3 specific tables have been created?
I have connected to my database, and have now gone totally blank as to how to check that ALL 3 tables (Table1, Table2, and Table3) have been created :frowning:

Here is what I have so far:

If db.Connect Then Dim rs As Recordset = db.SQLSelect("SELECT * FROM sqlite_master") End if

time to take a break. or you will just break more code than you fix. trust me on this one.

Sample code from “Database.TableSchema” in LR.

[code]//
// The following example gets the TableSchema for the connected database and displays each table name:
//
// App.DB is a connected database
Dim tables As RecordSet
tables = App.DB.TableSchema

If tables <> Nil Then
While Not tables.EOF
MsgBox(tables.IdxField(1).StringValue)
tables.MoveNext
Wend
tables.Close
End If[/code]

that would let you see if they have been created using the exact sql you used even
something like (note this IS forum code but you get the idea)

[code]
If db.Connect Then
Dim rs As Recordset = db.SQLSelect(“SELECT name , sql FROM sqlite_master where type = ‘table’”)
dim count as integer
while rs.eof <> true
// now maybe you have a dictionary entry for each table that is the sql used to create it
dim original as string = dict.value(rs.Field(1).StringValue)
dim asIs as string = rs.Field(2).StringValue

if replaceAll(original," ", "") = replaceAll(asIs," ", "") then
       // table was created the way we specified
      count = count + 1
else
      // it wasn't so what do we want to do ?
end if

wend

  if count <> dict.Count then
      // some tables are missing or not correctly specified ... now what ???????
  end if

End if[/code]