TransferText 2003 Error Trap (1 Viewer)

dequeue

New member
Local time
Yesterday, 18:56
Joined
May 28, 2009
Messages
1
Hello,

I would like to create an error trap for TransferText (much like thread 152642). The user pushes a button to upload the desired file into the database. If the file has new data everything works as expected. If the file has already been uploaded (old data) then it should fail and tell the user the data has already been uploaded. I do NOT like the "Microsoft Office Access was unable to append all the data to the table" error because :eek: users wouldn't understand it. I currently have the following:

DoCmd.SetWarnings False
DoCmd.TransferText acImportDelim, "Spec", "Table", Path, True, ""
If Err.Number = 10014 Then
msgbox "Not successful.", vbOKOnly, "Fail", "", vbError
Else
msgbox "Successful!", vbOKOnly, "Success!", "", vbInformation
End If
DoCmd.SetWarnings True

:mad: On Error goto X does not work either.
:confused:Is there a way to use try and catch to solve this problem?

Thank You!
Dequeue
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 00:56
Joined
Sep 12, 2006
Messages
15,651
what i do is

a) import to a new table

b) run a query to see if ther new items are already in the table
*** see notes below - this is your problem area

c) do an append query to insert new items

d) do an update query to adjust existing items

--------
now, b) is an app specific thing. if you find pre-existing items, this may be an error, or not - in which case you need to prompt the user for a response - ie does access stop the import, or does it continue.

hope this helps
 

Users who are viewing this thread

Top Bottom