Announcement

Collapse
No announcement yet.

Macro to Import csv into Access

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Macro to Import csv into Access



    Hi,

    This is my problem: I need to import a text file (.csv) into Access, using a macro. Can someone help me doing this? I am conversant with Excel VBA but am quite new to Access. Is there a way to "Record Macro" in access as we do in Excel? Where can I get a comprehensive help on all Access VBA Functions?

    Thanks in advance

    Regards,
    Siva K.Balan
    Analyst - SCM

  • #2
    Re: Macro to Import csv into Access

    Hi Siva

    Have a look at TransferText under Macros.

    or this is the code to transer csv files


    Code:
      DoCmd.TransferText acImportDelim, "", "Table1", "C:\Winxp\testing.csv", True, ""
    ' where table1 is your table

    Regards


    Maqbool

    Comment


    • #3
      Re: Macro to Import csv into Access

      Thanx a ton Maqbool! The code worked. This is the first ever piece of code I execute in Access. Can you guide me on where I can get a comprehensive help on other Access VBA Functions? (To manipulate the table, to insert a row or delete a record, using SQL Commands, etc.). That would be really helpful to me.

      Thanx again!

      Regards,
      Siva K.Balan

      Comment


      • #4
        Re: Macro to Import csv into Access

        Hi Siva:

        I think the best source is Access Help. and Microfsoft & MSDN have a lot sample codes and examples.

        Regards


        Maqbool

        Comment


        • #5
          Re: Macro to Import csv into Access

          Hi,

          I tried the above code but it doesn't seem to work for me.

          I have text files that have headers. And so I don't need the headers for all the text files.

          Thanks for your help.

          Comment


          • #6


            Re: Macro to Import csv into Access

            Is it possible to
            send a CSV file from excel to ACCESS? For example,
            look below. I just kind of getting
            involved on the whole IT side of things. I need to
            put like 400 of those type of files in Access. I
            tried to import it but all of the titles were
            everywhere.

            DMD Model 5 Prover
            Date: 6/7/2006
            Name: Duracap
            Location: Asbury Rd.
            Operator's Name or ID: 5600/6165
            Master Meter Type: 10M(10000cfh/283.2m3)
            Master Serial #: 391001
            Meter Output: Uncorrected

            Field Meter Type: T60
            Field Meter Serial #: 29
            Test Setup: routine
            Comments:
            valves ok/reg Ok/painted oiled & cleaned
            pressure = 14.60 running
            Span Test Result: PASS +/- 2.00

            Test Completed:
            Flow Rate: (acfh) Test Volume: (cf) Drive Rate or Pulses/Test: Ambient Pressure: (psia) Master Temperature: (F) Master Pressure: (inch) Master Differential: (inch) Master Volume: (cf) Meter Temperature: (F) Meter Pressure: (inch) Meter Differential: (inch) Test Duration: Upper Pass/Fail Limit: Lower Pass/Fail Limit: % Pressure Correction: % Temp. Correction: % Uncorrected Proof: % Corrected Proof: % Accuracy: % Error: Single Test Result:
            12:29:26 10004.57 1000 1000 14.308 83.347 -5.421 4.275 1028.141 80.978 0 0.002 00:06.1 2 2 -1.368 -0.436 102.527 100.684 99.321 -0.679 Pass

            Comment

            Working...
            X