capture error message: can't append all the records

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jkantner
    New Member
    • Sep 2006
    • 7

    capture error message: can't append all the records

    I am importing text files and using the data to create the records for a table with keys.
    If the user tries to import the same files twice, they get the huge error message that includes 'can't append all the records'. I know this is due to duplicate keys.
    What I would like to do is capture that message before it goes to the user and give them a more friendly message like 'You have already imported this data'.
    I tried to capture the error number in the error routine, but this error doesn't go to the error routine.
    How can I pre-empt this error message and give it my own error message ?

    09/19/06
    June H. Kantner
  • PEB
    Recognized Expert Top Contributor
    • Aug 2006
    • 1418

    #2
    Hi,

    How do you activate your import operation? Using what code of VB or using macro?

    :)

    Comment

    • jkantner
      New Member
      • Sep 2006
      • 7

      #3
      Originally posted by PEB
      Hi,

      How do you activate your import operation? Using what code of VB or using macro?

      :)
      -----------------
      I use VB code.
      I first import the records into an empty temp table.
      'Process found files
      If Len(.FileName) > 0 Then
      For i = 1 To .Foundfiles.Cou nt
      FoundFile_str = .Foundfiles(i)
      DoCmd.TransferT ext acImportFixed, "SAP_Incoming_s pec", "Tmp_InBound_SA P", FoundFile_str, False
      ------
      Then I process them into the main table using an append query.
      'Now append the imported data to the table
      DoCmd.OpenQuery "IS_SAP_ImportT mpToInbound_qry "

      Comment

      • PEB
        Recognized Expert Top Contributor
        • Aug 2006
        • 1418

        #4
        So,

        In this case you can desactivate the error message with

        docmd.setwarnin gs false

        DoCmd.TransferT ext acImportFixed, "SAP_Incoming_s pec", "Tmp_InBound_SA P",

        docmd.setwarnin gs True

        But get the error from the execution of docmd.

        In fact it isn't an error in VB that causes non execution of docmd

        but internal error in the command docmd...

        If there is something about this kind of errors see the help of MS Access...

        :)

        Comment

        Working...