VB to Foxpro

I'm using VB to link a Foxpro database table to an Access table so I can copy the fields I need for the Access table from the Foxpro table. My problem is if the program is shut down in the middle of processing this information and then they try to run it again, an error comes up because the program is trying to link a table that already exists. How can I check to see if the linked table exists so I can delete it if it does? Also, is there some property to check to see if a command button was clicked in the middle of a procedure?
Thank you very much for your time,
Who is Participating?
CrinConnect With a Mentor Commented:
Hello Swordmaster,

the easiest way is to leave code as is but add some lines of code

1. At the begin of the sub add
On error goto Trapper

2. Before link creation insert line with number 10 (for example :)

3. at the end of sub (before End Sub) type:

Exit Sub


If Erl = 10 then
  'your code to remove link
  Resume 10
  msgbox "Another error."
end if

There are more accurate ways - this is just easiest workaround :))

Sincerely yours,

SwordmasterAuthor Commented:
Thanks very much.
Hope my comments will help you now and in the future.

thanks for the points, I'm new on EE and this is interesting to me yet :))

Sincerely yours,

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.