On Mar 26, 7:09 am, jeanhurt...@gmail.com wrote:
> costtable ( I make update of to cost 2 or 3 times a year). I want to
> know how I can code if the spreadsheet transfer fail, the contents of
> the backupcosttable transfer to the cost table automatically. Thank
> you so much for your effort to help me.
>
> JC
Error trapping comes to mind. Assuming you run the excel trnsfer in a
vba module, you can write an error trapping rooutine to catch any
error in the transfer and append the old data back:
sub subX()
....
on error goto err_X 'set error trapping
transferdatabase ..... 'code to transfer excel data into table
Costtable
on error goto 0 'turn off error trapping
....'more coding as needed
exit sub
err_X:
'code to clear costtable, ex: currentdb.execute "Delete * FROM
Costtable"
'code to append old data into costtable, ex: currentdb.execute "Insert
into costtable select * from backupcosttable"
'msgbox to informed you of error (optional)
end sub
|