Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Import error msg box

Status
Not open for further replies.

micang

Technical User
Aug 9, 2006
626
US
Access 2000/2003

Hi All,

When importing a txt, excel etc into Access, how can I get a msg popup telling me that there are import errors or not?

This is the basic transfer code used:
Code:
Function Macro3()
On Error GoTo Macro3_Err

    DoCmd.TransferText acImportDelim, "VRR_Use", "checkformats", "F:\Data\svt2.txt", True, ""

Macro3_Exit:
    Exit Function

Macro3_Err:
    MsgBox Error$
    Resume Macro3_Exit

End Function
Can this be modified to achieve the msg popup?

Many Thanks

Michael
 
If it's just this procedure, that you're concerned about,
Then simply

Function Macro3()
On Error GoTo Macro3_Err

DoCmd.TransferText acImportDelim, "VRR_Use", "checkformats", "F:\Data\svt2.txt", True, ""



Macro3_Exit:
If err = 0 Then MsgBox "Import Succeeded"
Exit Function

Macro3_Err:
MsgBox Error$
Resume Macro3_Exit

End Function


because of you err handler, you'll get a msgbox regardless
if there is an error, ...now you ge one, if there is not
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top