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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Suppress Reponse To Update Records? 1

Status
Not open for further replies.

misscrf

Technical User
Jun 7, 2004
1,344
US
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!!!

misscrf

It is never too late to become what you could have been ~ George Eliot
 
DoCmd.SetWarnings False
DoCmd.RunSQL "..."
DoCmd.SetWarnings True

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
god that was quick!!! You rock, PHV. Thanks!

misscrf

It is never too late to become what you could have been ~ George Eliot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top