Results 1 to 4 of 4

Thread: How would you do this

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    May 2004
    Location
    england
    Posts
    598

    How would you do this

    Hi All,

    I open 5 tables like so

    VB Code:
    1. CurrentDatabaseName = "Qwest"
    2.        
    3.         rstQwest.Open "Qwest_Details", connQwest, adOpenKeyset
    4.        
    5.         rstQwest2.Open "Qwestname", connQwest, adOpenKeyset
    6.        
    7.        
    8.         CurrentDatabaseName = "Weldspec"
    9.        
    10.         rstWeldspec.Open "Weldspec_Details1", connWeldspec, adOpenKeyset, adLockOptimistic
    11.        
    12.         rstWeldspec2.Open "Tester_Weldspec", connWeldspec, adOpenKeyset, adLockOptimistic
    13.        
    14.         rstWeldspec3.Open "newtable", connWeldspec, adOpenKeyset, adLockOptimistic

    and it fails on this line as I have spelt it wrong.

    VB Code:
    1. rstWeldspec.Open "Weldspec_Details1", connWeldspec, adOpenKeyset, adLockOptimistic

    What I want to be able to do is to print out the table name that has failed. I could have string and set it to the table name before I open each table. But thought there might be a better way of doing this as it is later on that I want show the result.

    Thanks

    Loftty

  2. #2
    Lively Member
    Join Date
    Jul 2001
    Posts
    81

    Re: How would you do this

    Originally posted by loftty
    What I want to be able to do is to print out the table name that has failed. I could have string and set it to the table name before I open each table. But thought there might be a better way of doing this as it is later on that I want show the result.
    That would seem like the simplest solution to me. Especially since you want to use the name of the table later on, and not right when the error occurs.
    Rate my posts for a chance to win cash and prizes

  3. #3
    KING BODWAD XXI BodwadUK's Avatar
    Join Date
    Aug 2002
    Location
    Nottingham
    Posts
    2,176
    How would it know what table errored???

    In error handing cant you catch the complaint in the err object and print err.description???
    If you dribble then you are as mad as me

    Lost World Creations Website (XBOX Indie games)
    Lene Marlin

  4. #4
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106
    You could build the SQL statements out of a series of strings. When the error occurs, you could show the string that coincided with the error that occured. This would take a bit of bookkeeping to do things such as figuring out which line failed, but it would work. However, this is only slightly different from what you are suggesting anyways. The only difference would be that the string holding the tablename would be used in the SQL itself.
    My usual boring signature: Nothing

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width