Check For Table

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mike Charney

    #1

    Check For Table

    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


  • Lyle Fairfield

    #2
    Re: Check For Table

    "Mike Charney" <nothing@everyt hing.net> wrote in
    news:aOL0g.1649 1$tN3.1883@news svr27.news.prod igy.net:
    [color=blue]
    > 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[/color]

    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

    Comment

    • Thelma Lubkin

      #3
      Re: Check For Table

      Lyle Fairfield <lylefairfield@ aim.com> wrote:
      : "Mike Charney" <nothing@everyt hing.net> wrote in
      : news:aOL0g.1649 1$tN3.1883@news svr27.news.prod igy.net:

      :> 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:



      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


      Comment

      • Mike Charney

        #4
        Re: Check For Table


        "Thelma Lubkin" <thelma@alpha2. csd.uwm.edu> wrote in message
        news:e204ip$683 $1@uwm.edu...[color=blue]
        > Lyle Fairfield <lylefairfield@ aim.com> wrote:
        > : "Mike Charney" <nothing@everyt hing.net> wrote in
        > : news:aOL0g.1649 1$tN3.1883@news svr27.news.prod igy.net:
        >
        > :> 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
        >
        >[/color]
        Thanks Thelma.

        I guess Lyle was to busy being an arrogant butt to help.


        Comment

        • Tim Marshall

          #5
          Re: Check For Table

          Mike Charney wrote:
          [color=blue]
          > Does the table exist, Yes = Delete it, No=Continue code execution.[/color]

          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.Execu te "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

          Comment

          • ckp21082
            New Member
            • Apr 2006
            • 5

            #6
            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

            Comment

            Working...