[AccessD] Link CSV file in VBA

Rocky Smolin - Beach Access Software bchacc at san.rr.com
Tue Mar 1 09:32:04 CST 2005


Sander:

Although not as quick and elegant as Steve's solution, I usually read the 
file into a temporary table.  It's easier to work with that way, and I have 
found in the past that the TrasnferText command was not, shall we say, 
robust.  Seemed unreliable but I can't remember exactly what it was that 
gave me fits at the time.

    Open strFolder & txtPatientName & "2.txt" For Input As #1
    Do While Not EOF(1)
        Input #1, strQID, strRAnswer, gstrBackQID
        rstResponses.AddNew
        rstResponses!fldPatientID = lngPatientID
        rstResponses!fldQID = strQID
        rstResponses!fldRAnswer = strRAnswer
        rstResponses!fldBackQID = gstrBackQID
        rstResponses.Update
    Loop

HTH

Rocky Smolin
Beach Access Software
http://www.e-z-mrp.com
858-259-4334

----- Original Message ----- 
From: "Steve Conklin (Developer at UltraDNT)" <Developer at ultradnt.com>
To: "'Access Developers discussion and problem solving'" 
<accessd at databaseadvisors.com>
Sent: Tuesday, March 01, 2005 7:13 AM
Subject: RE: [AccessD] Link CSV file in VBA


> All do-able with DoCmd ...
>
> Dig in help for all paramters yu will need, something like:
>
> Sub ImportExport
>
> DoCmd.TransferText acLinkDelim, , "tblCSV", "c:\temp\yada-yada.xls"
> DoCmd.RunSQL "query name"
> DoCmd.TransferText acExportDelim, , , "c:\temp\blah-blah.xls"
>
> End Sub
>
>
> Hth
> Steve
>
>
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Sad Der
> Sent: Tuesday, March 01, 2005 9:47 AM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] Link CSV file in VBA
>
>
> Terri,
>
> my mistake...I wasn't clear with my question. What I
> meant was:
> I need to link a csv file in Access 2000 USING VBA
> does anybody know how to do this?
>
> Background info:
> I need to run 68 reports. They all have 1 or more csv
> as input source. At this point we need to manually
> link them as described by terri. This is very time
> consuming. I want to create something so that the user
> selects a report and then automagically the following
> things happen:
> - the required csv files are linked (or imported)
> - the required queries are started
> - the created table (via the queries) is exported to
> Excel.
>
> That's all.
>
> Sander
>
> --- Terri Jarus <jarus at amerinet-gpo.com> wrote:
>
>> You do that exactly as you would link any other
>> file/table.  Select File
>> - Get External Data - Link Tables; select Text Files
>> from Files of Type
>> dropdown and select the appropriate file.
>>
>> That's all there is to it.
>>
>> Terri Jarus
>> Vice President, Contract Services
>> jarus at amerinet-gpo.com
>> 314-542-1902
>>
>> >>> accessd666 at yahoo.com 3/1/2005 12:52:34 AM >>>
>>
>> Hi group,
>>
>> I need to link a csv file in Access 2000.
>>
>> Does anybody know how I can achieve this?
>>
>> Thnx
>>
>> Sander
>>
>>
>>
>> __________________________________
>> Do you Yahoo!?
>> Yahoo! Sports - Sign up for Fantasy Baseball.
>> http://baseball.fantasysports.yahoo.com/
>> -- 
>> AccessD mailing list
>> AccessD at databaseadvisors.com
>> http://databaseadvisors.com/mailman/listinfo/accessd
>> Website: http://www.databaseadvisors.com
>>
>>
>>
> ------------------------------------------------------------------------
> ---
>> This email and any files transmitted with it are
>> confidential and
>> intended solely for the use of the individuals or
>> entities to whom they
>> are addressed. If you have received this email in
>> error please return
>> it to the sender, and erase any copies thereof.
>> Copyright 2005 Amerinet 1nc.
>> -- 
>> AccessD mailing list
>> AccessD at databaseadvisors.com
>> http://databaseadvisors.com/mailman/listinfo/accessd
>> Website: http://www.databaseadvisors.com
>>
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Read only the mail you want - Yahoo! Mail SpamGuard.
> http://promotions.yahoo.com/new_mail
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 




More information about the AccessD mailing list