By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,705 Members | 1,891 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,705 IT Pros & Developers. It's quick & easy.

Supress Update Records Question - Answer Yes?

misscrf
P: 13
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?

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub Command0_Click()
  3. Dim strDocPath As String
  4. Dim strCurrentFile As String
  5.  
  6. strDocPath = "O:\ProjectShare\123456 Project\test\"
  7. strCurrentFile = Dir(strDocPath & "*.csv")
  8.  
  9. Do Until strCurrentFile = ""
  10.  
  11. DoCmd.TransferText acImportDelim, "myspecs", "tblCSV", strDocPath & strCurrentFile, -1
  12. DoCmd.RunSQL "UPDATE tblCSV SET tblCSV.FileName =  """ & strCurrentFile & """ WHERE tblCSV.FileName Is Null"
  13. strCurrentFile = Dir
  14. Loop
  15.  
  16. End Sub
  17.  
Thanks!!!
Feb 5 '09 #1
Share this Question
Share on Google+
3 Replies


Expert 100+
P: 1,287
DoCmd.SetWarnings False

You should set it back to True after you are done though.
Feb 5 '09 #2

misscrf
P: 13
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.
Feb 5 '09 #3

Expert 100+
P: 1,287
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?
Feb 5 '09 #4

Post your reply

Sign in to post your reply or Sign up for a free account.