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

DoCmd.TransferText acImportDelim is appending data; I need it to do?

P: 3
I am using DoCmd.TransferText acImportDelim to import a number of text files. I thought this command would overwrite current table data with new, but instead, it is appending.

How do I get this command to overwrite the current table with new data each month?
Apr 5 '12 #1
Share this Question
Share on Google+
5 Replies

Expert Mod 15k+
P: 31,418
You can either delete the table itself (slower) or run a SQL job just before the import to clear the table :
Expand|Select|Wrap|Line Numbers
  1. Dim dbVar As DAO.Database
  3. Set dbVar = CurrentDb
  4. Call dbVar.Execute("DELETE FROM [TableName]")
Apr 5 '12 #2

P: 3

Thank you. Looks like I was wrong; Access DOES append, not overwrite, so will have to use something as you suggest. I am very new to VBA. If I created a list of the tables I need to empty (in another table), can I step down through that list somehow? I thought of creating a CASE statement within an SQL, but again, that means listing a statement for each of the 50 tables I need to clean out before importing. I was hoping to avoid that if possible.
Apr 5 '12 #3

Expert Mod 15k+
P: 31,418
You certainly can, but if you want more specific help then you need to start thinking a bit before you post, and decide what information is required in the question. General questions like this can be answered (and I have) but if you want more direct help, then you'll need to start asking your questions more sensibly (with some thought applied beforehand).
Apr 5 '12 #4

P: 3
One question led to another...sorry, I did not realize I needed to submit an entirely new post. As I said, I am new to VBA (and to this site). Sorry to bother you.
Apr 6 '12 #5

Expert Mod 15k+
P: 31,418
If you have a question that is essentially different from the original then that is true. If, as in this case, you simply don't have a very sensible question in the first place, then my suggestion was that you put a little more effort into formulating it before posting.

The more your question makes sense, and describes the problem you're actually trying to deal with, the easier it is for us to reply with something that's helpful. Certainly that's something that becomes more obvious with experience, but I don't believe experience is required to appreciate this very basic point. This pertains to your post #3 which is so loosely phrased, and with so little information, that a simple yes or no is all that can be expected in reply. You are not precluded from asking the same question, properly, in the same thread. It is only new questions that rule applies to.

I hope I have clarified the situation as your response seemed to indicate you hadn't understood the point very well.
Apr 6 '12 #6

Post your reply

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