Re: if table exist



adil wrote:
Hi ,
does any knows how can i check the existence of a table in a ms access database ?i need a sql statement that provide this function.
Thanks .


In a code module you can a function like the following

Function TDE(strTable As String) As Boolean
Dim tdf As TableDef
On Error GoTo 0
On Error Resume Next
Set tdf = CurrentDb.TableDefs(strTable)
TDE = (Err.Number = 0)
End Function

You can call this function, in a query, like this
TableExists : TDE("Junk")

If you are calling this from an external app, you'll need to read your documentation.
.



Relevant Pages

  • Re: Normalize table
    ... Dim tdf As DAO.TableDef ... Public Sub NormalizeTable(ByVal strSrcTable As String, ... '--executing the SQL statement (dbFailOnError just makes ... DBEngine.Execute strSQL, dbFailOnError ...
    (comp.databases.ms-access)
  • Re: Can VB8 read Access DBs?
    ... Dim fld As DAO.Field ... On Error GoTo Form_Activate_Err_Tabledef ... Dim tdf As DAO.TableDef ... When I try to read the Access 97 database with the VB8 program, ...
    (microsoft.public.vb.database.dao)
  • RE: Leave cell value untouched if Custom Function errors
    ... You will need to put error testing into the function. ... > find data in an external Access database using ADO, ... > relevant cell. ...
    (microsoft.public.excel.programming)
  • Re: Continuing when an Error occurs
    ... remember to reset after (On Error Goto 0). ... If Not fld Is Nothing Then ... > access database. ...
    (microsoft.public.excel.programming)