PC Review


Reply
Thread Tools Rate Thread

Delete Table...

 
 
learning_codes@hotmail.com
Guest
Posts: n/a
 
      27th May 2011
Hi,

I'm wondering if you can help me how to check the "Table One" before
deleting the table. If there is no table three, the message box
showing "need to create table 3". The most thing I need to know how
to check the table One before delete the table using command button.


DoCmd.DeleteObject acTable, "Table One"
DoCmd.DeleteObject acTable, "Table Two"

I would appreciate your help.
Thanks...
 
Reply With Quote
 
 
 
 
John W. Vinson
Guest
Posts: n/a
 
      27th May 2011
On Fri, 27 May 2011 13:24:48 -0700 (PDT), "(E-Mail Removed)"
<(E-Mail Removed)> wrote:

>Hi,
>
>I'm wondering if you can help me how to check the "Table One" before
>deleting the table. If there is no table three, the message box
>showing "need to create table 3". The most thing I need to know how
>to check the table One before delete the table using command button.
>
>
> DoCmd.DeleteObject acTable, "Table One"
> DoCmd.DeleteObject acTable, "Table Two"
>
>I would appreciate your help.
>Thanks...


I'm not sure I understand. You say you need to check Table One, then "if there
is no table three". Why are you deleting and creating tables (apparently
routinely) in any case? That's unusual, and generally not necessary!

The simplest way to check for the existance of a table is probably to see if
it's in the (undocumented and concealed) MSysObjects table:

IF IsNull(DLookUp("[Name]", "MSysObjects", "[Type] = 1 AND [Name] = 'Table
One'") Then
<the table does not exist>
Else
<it does exist>
End If
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/For...-US/accessdev/
http://social.answers.microsoft.com/.../en-US/addbuz/
and see also http://www.utteraccess.com
 
Reply With Quote
 
learning_codes@hotmail.com
Guest
Posts: n/a
 
      28th May 2011
On May 27, 6:35*pm, John W. Vinson
<jvinson@STOP_SPAM.WysardOfInfo.com> wrote:
> On Fri, 27 May 2011 13:24:48 -0700 (PDT), "learning_co...@hotmail.com"
>
> <learning_co...@hotmail.com> wrote:
> >Hi,

>
> >I'm wondering if you can help me how to check the "Table One" before
> >deleting the table. * *If there is no table three, the message box
> >showing "need to create table 3". * *The most thing I need to know how
> >to check the table One before delete the table using command button.

>
> > * *DoCmd.DeleteObject acTable, "Table One"
> > * *DoCmd.DeleteObject acTable, "Table Two"

>
> >I would appreciate your help.
> >Thanks...

>
> I'm not sure I understand. You say you need to check Table One, then "if there
> is no table three". Why are you deleting and creating tables (apparently
> routinely) in any case? That's unusual, and generally not necessary!
>
> The simplest way to check for the existance of a table is probably to seeif
> it's in the (undocumented and concealed) MSysObjects table:
>
> IF IsNull(DLookUp("[Name]", "MSysObjects", "[Type] = 1 AND [Name] = 'Table
> One'") Then
> * *<the table does not exist>
> Else
> * *<it does exist>
> End If
> --
>
> * * * * * * *John W. Vinson [MVP]
> *Microsoft's replacements for these newsgroups:
> *http://social.msdn.microsoft.com/For...-US/accessdev/
> *http://social.answers.microsoft.com/.../en-US/addbuz/
> *and see alsohttp://www.utteraccess.com


Thank you so much.

Will it possible to have the link or import tables from other database
if the database has the tables available before import into the new
database.

I would like to see if my new database can check and alert me if need
to add table to other database before import or link the tables from
other database to my new database.
Sometime, I get error and couldnt find the table 1 or 2 from other
database because I forget to add table 1 and 2 on my old database. It
will alert me if need to add table 1 before
importing or linking to table 1 from old database to new database.

DoCmd.TransferDatabase acImport, "Microsoft Access", "Other
Database", acTable, "Table1-Other Database", "Table1-New Database",
False

DoCmd.TransferDatabase acLink, "Microsoft Access", "Other
Database", acTable, "Table2-Other Database", "Table2-New Database",
False


Your help would be much appreciated.
Thanks...
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete query unable to delete records from table. Fix how? =?Utf-8?B?TG9uZ1RvbQ==?= Microsoft Access Queries 8 15th Apr 2007 11:29 AM
Cascading Delete...#Delete found in table...what the heck is going on! Andre Laplume via AccessMonster.com Microsoft Access Queries 6 2nd Jun 2005 06:26 PM
How do I programmatically delete a link to a table in a linked file where the table has been deleted? Jon A Microsoft Access Form Coding 2 14th Apr 2005 01:08 AM
Delete Query - Delete records in Table 1 using parameters from Tab =?Utf-8?B?SmVu?= Microsoft Access Queries 2 21st Mar 2005 01:13 PM
How do I stop Access from asking confirmation to delete a table in a Make-Table Query? Mike Webb Microsoft Access Queries 4 8th Mar 2004 08:54 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:08 PM.