Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / New Users / October 2005

Tip: Looking for answers? Try searching our database.

table in database

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
alekm - 05 Oct 2005 10:39 GMT
Hi,
how can I determine, through code, whether table_temp exists in my database
(or it is already deleted)?
Thanx

alek_mil
Justin Hoffman - 05 Oct 2005 10:49 GMT
> Hi,
> how can I determine, through code, whether table_temp exists in my
[quoted text clipped - 3 lines]
>
> alek_mil

Paste the function into a new module, make sure you have a reference to the
DAO object library and make sure you compile the code.  Then you use it as
shown below:

If TableExists("table_temp") Then
   MsgBox "It exists"
Else
   MsgBox "It doesn't exist"
End If

Function TableExists(strTableName As String) As Boolean

   On Error GoTo Err_Handler

   Dim dbs As DAO.Database
   Dim tdf As DAO.TableDef

   Set dbs = CurrentDb

   For Each tdf In dbs.TableDefs
       If tdf.Name = strTableName Then
           TableExists = True
           Exit For
       End If
   Next tdf

Exit_Handler:
   On Error Resume Next
   Set tdf = Nothing
   Set dbs = Nothing

   Exit Function

Err_Handler:
   MsgBox Err.Description, vbExclamation, "Error No: " & Err.Number
   Resume Exit_Handler

End Function
alekm - 05 Oct 2005 11:22 GMT
Thank you
just what I needed

alek_mil
Jeff Boyce - 05 Oct 2005 13:19 GMT
An alternative to making/deleting a temp table (if I read between the lines
of your post correctly) would be to create a permanent table, then append
records to and delete records from that table.

Signature

Regards

Jeff Boyce
<Office/Access MVP>

> Hi,
> how can I determine, through code, whether table_temp exists in my database
> (or it is already deleted)?
> Thanx
>
> alek_mil
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.