Supress Update Records Question - Answer Yes?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • misscrf
    New Member
    • Sep 2006
    • 13

    Supress Update Records Question - Answer Yes?

    I have put this code together (from various posts on the web and the help file...)

    It loops through a folder of CSVs and imports them into a table, updating a column with the file name. What I am stuck with is that it asks me Yes or No do I want to update the records for the update part. Anyway I can get it to just answer yes?

    Code:
     
    Private Sub Command0_Click()
    Dim strDocPath As String
    Dim strCurrentFile As String
    
    strDocPath = "O:\ProjectShare\123456 Project\test\"
    strCurrentFile = Dir(strDocPath & "*.csv")
    
    Do Until strCurrentFile = ""
    
    DoCmd.TransferText acImportDelim, "myspecs", "tblCSV", strDocPath & strCurrentFile, -1
    DoCmd.RunSQL "UPDATE tblCSV SET tblCSV.FileName =  """ & strCurrentFile & """ WHERE tblCSV.FileName Is Null"
    strCurrentFile = Dir
    Loop
    
    End Sub
    Thanks!!!
  • ChipR
    Recognized Expert Top Contributor
    • Jul 2008
    • 1289

    #2
    DoCmd.SetWarnin gs False

    You should set it back to True after you are done though.

    Comment

    • misscrf
      New Member
      • Sep 2006
      • 13

      #3
      Thanks! this is all I needed. I kind of feel stupid for not thinking of it. I think I just wasnt sure how it would know I wanted yes and not no.

      Comment

      • ChipR
        Recognized Expert Top Contributor
        • Jul 2008
        • 1289

        #4
        Don't feel bad, I still remember looking for the answer to the same question myself. Who's going to read all the functions of DoCmd?

        Comment

        Working...