Page 2 of 2 FirstFirst 12
Results 16 to 25 of 25
  1. #16
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    830
    You also do not turn the warnings back on.
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  2. #17
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    2,660
    Quote Originally Posted by templeowls View Post
    Could you input the error comment into the code I've supplied? I'm honestly not sure how to input that
    No added line, just add a single quote like this:

    ' On Error GoTo ImportIt_Err

    Now when running the code, a dialog box should pop up with an option button to debug. Click that and the VBE should open with the error line highlighted.

  3. #18
    Welshgasman is offline Expert
    Windows 10 Access 2007
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    622
    I believe you can just use
    Code:
    Delete * FROM RawAudit
    Please, please use # when posting code snippets.
    Cross Posting Etiquette: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?search_query=debug+access+vba



  4. #19
    templeowls is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2019
    Posts
    101
    I dropped that line in but when I try to import, no additional dialog box appears...

  5. #20
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    2,660
    Quote Originally Posted by templeowls View Post
    I dropped that line in but when I try to import, no additional dialog box appears...
    You have 4 people posting suggestions. When you post back, it would be very helpful to know what post or person you are replying to.

    I assume you are replying to my post #17, which you should read again. No added line, just modify the existing line by adding the single quote.

  6. #21
    templeowls is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2019
    Posts
    101
    I assume you are replying to my post #17, which you should read again. No added line, just modify the existing line by adding the single quote.
    Yes I was replying to you. Sorry.

    Okay that makes sense. I added that single quote and the debugger is keying on ln 26:

    DoCmd.RunSavedImportExport "Import-PHI"

  7. #22
    templeowls is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2019
    Posts
    101
    I figured it out. The workbook name needs to match the file name in the import. Jeez.

    Thank you all!!!

  8. #23
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    2,660
    Quote Originally Posted by templeowls View Post
    Yes I was replying to you. Sorry.

    Okay that makes sense. I added that single quote and the debugger is keying on ln 26:
    OK, that's a saved import specification that gives Access the details of how to import the data.csv file. It contains an error. The specification is within the DB, but not shown in your post.
    You'll need to import your DB here for someone to trouble shoot that. We will also need a sample data.csv file and a copy of the spreadsheet that you are trying to export to.

  9. #24
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    2,660
    Quote Originally Posted by templeowls View Post
    I figured it out. The workbook name needs to match the file name in the import. Jeez.

    Thank you all!!!
    Good work. Good luck with the project!

  10. #25
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    830
    try this code if you want to programatically change the xml in the saved import.

    Code:
    '?CurrentProject.ImportExportSpecifications(0).XML
    
    Sub ChangeImportPath(StrNewPath As String, strSpecName As String)
        On Error GoTo Err_Handler
        
    ' MSXML2 requires reference to "Microsoft XML, v6.0"
    ' earlier versions are probably compatible, remember to use the appropriate
    ' DOMDocument object  version.
    ' code borrowed from Jason Hardman's contribution at this link:
    ' https://stackoverflow.com/questions/...9e56e187f953f7
        
          
        
        Dim XMLData As MSXML2.DOMDocument60
        Dim ImportSpec As ImportExportSpecification
        Dim XMLNode As IXMLDOMNode
        'Dim StrNewPath As String
        
        ' Get XML object to manage the spec data
        Set XMLData = New MSXML2.DOMDocument60
    
    
        
        ' existing Import Specification (should be set up manually with relevant name)
        Set ImportSpec = CurrentProject.ImportExportSpecifications(strSpecName)
        
        XMLData.LoadXML ImportSpec.XML
        
        
        
        ' change it's path to the one specified
        With XMLData.DocumentElement
            .setAttribute "Path", StrNewPath
        End With
    
    
        ImportSpec.XML = XMLData.XML
        
        ' run the updated import
        'Debug.Print CurrentProject.ImportExportSpecifications(0).XML
        ImportSpec.Execute
    
    
    Exit_Handler:
        Set ImportSpec = Nothing
        Set XMLData = Nothing
        Exit Sub
    
    
    Err_Handler:
        Select Case err.Number
            Case 3011
                MsgBox "Replacement path is invalid", vbCritical 'Profile name is wrong or MS Exchange server is offline
            Case Else
                MsgBox err.Number & " - " & err.Description & vbCrLf _
                       & "Please take note of the error code and contact your System Administrator", vbCritical
        End Select
        Resume Exit_Handler
        
    End Sub
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 07-24-2015, 11:31 AM
  2. Replies: 2
    Last Post: 12-19-2014, 06:35 PM
  3. The search key was not found in any record
    By virtualprg in forum Import/Export Data
    Replies: 46
    Last Post: 08-26-2014, 10:51 AM
  4. Search key was not found in any record.
    By mgio in forum Access
    Replies: 2
    Last Post: 08-05-2014, 01:32 PM
  5. Replies: 2
    Last Post: 11-12-2013, 07:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums - Senior Forums