var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Test for table
Is there a way to code a test for a specific tablename (i.e., if table exists, run macro otherwise exit)?
Here's some code I have that tests for a file:
If Dir("c:\sidewalks\swk_inspect.mdb") = "" Then
However, now I want to test for a specific tablename.
A very brief search turned up a number of threads, including this one with several different methods:
Try this function
Example to call it
Function IsTableExist(TableName As String) As Boolean
Dim db As Database, tbl As TableDef
On Error GoTo ERR_Table_Exist
Set db = CurrentDb : Set tbl = db.TableDefs(TableName)
IsTableExist = True
Set db = Nothing: Set tbl = Nothing
IsTableExist = False
if IsTableExist("yourTableNameUwant2Check") then
DoCmd.RunSQL ("DROP TABLE yourTableNameUwant2Check")
One more thing. I want to test the location of a table in a remote network database. Where in the code found in http://www.mvps.org/access/tables/tbl0001.htm do I place the path, database name, and table name?
just pass the name of the table you are looking for as part of the function call
you will need to make sure the DAO library is selected as part of your code
view a form in design
switch to code window
tools | references
select microsoft DAO 3.6 or later
Example to code to instantiate a database object referencing a remote database:
Originally Posted by esskaykay
You could alter your function to accept the database fully qualified name as a parameter
Set db = Workspaces(0).OpenDatabase("C:\MyDatabaseFolder\MyDB.mdb")
ur codings are working excelent.