By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
460,028 Members | 1,072 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 460,028 IT Pros & Developers. It's quick & easy.

Check For Table

P: n/a
I have an Access data project. In this project I have a form that when
Access starts is loaded and this form has VBA code attached to it.

One of the first things I need to do is check if a table called tblimport
exists. If this table exists then I need to delete it. I have tried looking
through the web but I can not find a simple solution to this. I do not want
a separate module, just a couple lines of code.

Does the table exist, Yes = Delete it, No=Continue code execution.

Does any one know how to do this?

Thanks,
Mike
m charney at dunlap hospital dot org
Apr 17 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
"Mike Charney" <no*****@everything.net> wrote in
news:aO******************@newssvr27.news.prodigy.n et:
I have an Access data project. In this project I have a form that when
Access starts is loaded and this form has VBA code attached to it.

One of the first things I need to do is check if a table called
tblimport exists. If this table exists then I need to delete it. I
have tried looking through the web but I can not find a simple
solution to this. I do not want a separate module, just a couple lines
of code.

Does the table exist, Yes = Delete it, No=Continue code execution.

Does any one know how to do this?

Thanks,
Mike
m charney at dunlap hospital dot org


I have a one line solution but I guess that's too few.

Besides, 99 times out of 100, it's bad form and/or reflects poor design to
be constantly deleting and creating a table, and I wouldn't want to
propogate bad form or poor design.

What's that, you just asked or a solution and not a lecture? Tant pis!

--
Lyle Fairfield
Apr 17 '06 #2

P: n/a
Lyle Fairfield <ly***********@aim.com> wrote:
: "Mike Charney" <no*****@everything.net> wrote in
: news:aO******************@newssvr27.news.prodigy.n et:

:> I have an Access data project. In this project I have a form that when
:> Access starts is loaded and this form has VBA code attached to it.
:>
:> One of the first things I need to do is check if a table called
:> tblimport exists. If this table exists then I need to delete it. I
:> have tried looking through the web but I can not find a simple
:> solution to this. I do not want a separate module, just a couple lines
:> of code.
:>
:> Does the table exist, Yes = Delete it, No=Continue code execution.
:>
:> Does any one know how to do this?
:>
:> Thanks,
:> Mike
:> m charney at dunlap hospital dot org

: I have a one line solution but I guess that's too few.

: Besides, 99 times out of 100, it's bad form and/or reflects poor design to
: be constantly deleting and creating a table, and I wouldn't want to
: propogate bad form or poor design.

: What's that, you just asked or a solution and not a lecture? Tant pis!

: --
: Lyle Fairfield

Now that you've heard the advice of a master user of Access,
here's something found by a 'fair' user of google:

http://www.fontstuff.com/access/acctut16.htm

gives the one-line of code for deleting a table. I'm sure Lyle
can actually do the whole thing in one line, but *I* would need
to add error-trapping code to handle the error if the table
doesn't exist.
--thelma
Apr 17 '06 #3

P: n/a

"Thelma Lubkin" <th****@alpha2.csd.uwm.edu> wrote in message
news:e2**********@uwm.edu...
Lyle Fairfield <ly***********@aim.com> wrote:
: "Mike Charney" <no*****@everything.net> wrote in
: news:aO******************@newssvr27.news.prodigy.n et:

:> I have an Access data project. In this project I have a form that when
:> Access starts is loaded and this form has VBA code attached to it.
:>
:> One of the first things I need to do is check if a table called
:> tblimport exists. If this table exists then I need to delete it. I
:> have tried looking through the web but I can not find a simple
:> solution to this. I do not want a separate module, just a couple lines
:> of code.
:>
:> Does the table exist, Yes = Delete it, No=Continue code execution.
:>
:> Does any one know how to do this?
:>
:> Thanks,
:> Mike
:> m charney at dunlap hospital dot org

: I have a one line solution but I guess that's too few.

: Besides, 99 times out of 100, it's bad form and/or reflects poor design
to
: be constantly deleting and creating a table, and I wouldn't want to
: propogate bad form or poor design.

: What's that, you just asked or a solution and not a lecture? Tant pis!

: --
: Lyle Fairfield

Now that you've heard the advice of a master user of Access,
here's something found by a 'fair' user of google:

http://www.fontstuff.com/access/acctut16.htm

gives the one-line of code for deleting a table. I'm sure Lyle
can actually do the whole thing in one line, but *I* would need
to add error-trapping code to handle the error if the table
doesn't exist.
--thelma

Thanks Thelma.

I guess Lyle was to busy being an arrogant butt to help.
Apr 17 '06 #4

P: n/a
Mike Charney wrote:
Does the table exist, Yes = Delete it, No=Continue code execution.


Why don't you just simply run the equivalent of a delete query:

Delete * from tblimport

and do your coding based on an empty table?

Not sure how this is done exactly in ADO, but the DAO equivalent, is a
simple

CurrentDb.Execute "delete * from tblimport", dbFailOnError

As Lyle says, it's frankly kind of silly to be deleting and,
presumeably, creating tables in an app this way. Replace your "create
table" type code with an append query.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Apr 17 '06 #5

P: 5
i want to get public rowid in MS-ACCESS
can anybody know hot to get rowid of table same as in Oracle


if know then tell me plz
Apr 22 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.