Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

This is my firt question here, so hello every body :)

I have to write vba code in Excel (executed by button) which will add records to existing table in Access from text file. Data in text file is seperated by semi-colon with first row as a header. The file is all the time in the same location, only data is changing. I work on 2010 version of MS Office.

I am not quite familiar with VBA, so I don't know how to start - I am able to record and play macros in Excel.

Thank you in advance for your help!

share|improve this question
 
You can start with a Google Search –  jacouh Nov 15 at 10:07
 
@jacouh I've already started to learn vba. I was also searching in google for the solution, but I didn't find any or because I don't know vba I wasn't able to recognize one. –  piaskun79 2 days ago
 
Next time you should always show up your attempts of coding, as users in this site love it...Avoiding some reputation sanctions. –  jacouh 2 days ago
 
@jacouh the beginner mistake :) I will use your advice in the future. Thanks! –  piaskun79 yesterday

1 Answer

Hope this helps!! I don't have office 2010 but this might give you a fair idea on how to accomplish this as you are not new to VBA...This is done in MSO 2003

Sub test_csv_import()
    Dim acAppl As Access.Application

    Set acAppl = New Access.Application

    acApp.OpenCurrentDatabase "D:\yvxs\db1.mdb"

    acApp.DoCmd.TransferText acImportDelim, "MyImportSpec", "MyCSV", "D:\yvxs\mycsv.csv", True

    acAppl.CloseCurrentDatabase
    acAppl.Quit acQuitSaveNone

    Set acAppl = Nothing

End Sub
share|improve this answer
 
Thanks for help. As far as I see without base knowledge of vba I won't be able to modify your code or any other :) –  piaskun79 2 days ago
 
Sorry!! I missed the part where you had mentioned about being new to VBA, Well!! get started, and let us know if you get stuck, more over this forum is about this only.If you can give a complete structure of what you are trying to achieve (access table definition, csv file etc) it will help us to provide more specific solution. All the best –  Youbaraj Sharma 2 days ago
 
I used this solution - for my needs it will be enough, for now :) –  piaskun79 yesterday

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.