Table already exists exception

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

    #1

    Table already exists exception

    hi, All

    I have a table in Access and I am using a storedProcedure (Make-Table query)
    to overwrite this table.

    It gives an error that 'Table Already Exists', which is true. But i want it
    to continue overwriting the existing table and not stop and give me an
    error.
    In VB6 i would have used On error resume Next, but i havent got grips yet
    with VB.net exception handling.
    Can someone please tell me how to tell the program to continue when this
    error message occurs.

    TIA
    irfan


  • Oenone

    #2
    Re: Table already exists exception

    Irfan wrote:[color=blue]
    > In VB6 i would have used On error resume Next, but i havent got
    > grips yet with VB.net exception handling.
    > Can someone please tell me how to tell the program to continue when
    > this error message occurs.[/color]

    \\\
    Try
    [Create the table here]
    Catch
    'An error occurred but we're going to ignore it
    End Try

    [rest of your code here]
    ///

    I think there are much better ways to do this, but to directly answer the
    question, the above should do what you want.

    --

    (O)enone


    Comment

    • Paul Clement

      #3
      Re: Table already exists exception

      On Wed, 8 Jun 2005 15:06:39 +0100, "Irfan" <irfan@asc-ltd.co.uk> wrote:

      ¤ hi, All
      ¤
      ¤ I have a table in Access and I am using a storedProcedure (Make-Table query)
      ¤ to overwrite this table.
      ¤
      ¤ It gives an error that 'Table Already Exists', which is true. But i want it
      ¤ to continue overwriting the existing table and not stop and give me an
      ¤ error.
      ¤ In VB6 i would have used On error resume Next, but i havent got grips yet
      ¤ with VB.net exception handling.
      ¤ Can someone please tell me how to tell the program to continue when this
      ¤ error message occurs.
      ¤

      You can't overwrite the table. It must be dropped from the database first. You can use SQL:

      DROP TABLE TableName


      Paul
      ~~~~
      Microsoft MVP (Visual Basic)

      Comment

      • Irfan

        #4
        Re: Table already exists exception

        thanks Paul. This is what i had to do

        Irfan

        "Paul Clement" <UseAdddressAtE ndofMessage@sws pectrum.com> wrote in message
        news:nhbea11fps 5tr0q11hvrl4e6j o0f55jbat@4ax.c om...[color=blue]
        > On Wed, 8 Jun 2005 15:06:39 +0100, "Irfan" <irfan@asc-ltd.co.uk> wrote:
        >
        > ¤ hi, All
        > ¤
        > ¤ I have a table in Access and I am using a storedProcedure (Make-Table
        > query)
        > ¤ to overwrite this table.
        > ¤
        > ¤ It gives an error that 'Table Already Exists', which is true. But i want
        > it
        > ¤ to continue overwriting the existing table and not stop and give me an
        > ¤ error.
        > ¤ In VB6 i would have used On error resume Next, but i havent got grips
        > yet
        > ¤ with VB.net exception handling.
        > ¤ Can someone please tell me how to tell the program to continue when this
        > ¤ error message occurs.
        > ¤
        >
        > You can't overwrite the table. It must be dropped from the database first.
        > You can use SQL:
        >
        > DROP TABLE TableName
        >
        >
        > Paul
        > ~~~~
        > Microsoft MVP (Visual Basic)[/color]


        Comment

        Working...