[AccessD] TransferText Failling

Rocky Smolin - Beach Access Software bchacc at san.rr.com
Tue Mar 11 00:23:00 CST 2003


Drew:

Is there any advantage to using CurrentDB. vs set db=CurrentDB and using db
as the object?

Rocky

----- Original Message -----
From: "Drew Wutka" <DWUTKA at marlow.com>
To: <accessd at databaseadvisors.com>
Sent: Monday, March 10, 2003 2:52 PM
Subject: RE: [AccessD] TransferText Failling


> Here's my code....just writing it in the email..it's really simple to do.
>
> Function DumpRecordset(strSQL as String,strFileName as String)
> Dim f As Long
> Dim rs As recordset
> Dim strData as String
> dim i As Long
> set rs=CurrentDB.OpenRecordset(strSQL) 'this is for Access 97 and DAO
> if rs.eof=False then rs.movefirst
> f=FreeFile
> If Dir(strFileName)<>"" Then Kill strFileName
> Open strFileName for binary access read as f
> Do Until rs.eof=True
> strData=""
> for i=0 to rs.Field.Count-1
> strData=strData & rs.Field(i).Value & ","
> Next i
> strData=Left(strData,len(strData)-1) & vbcrlf
> Put f,,strData
> rs.movenext
> loop
> rs.close
> Close f
> End Function
>
> All in all, pretty simple code.  (You can change the "," to whatever
> delimiter you want.
>
> Drew
>
> -----Original Message-----
> From: Hale, Jim [mailto:jim.hale at fleetpride.com]
> Sent: Monday, March 10, 2003 4:13 PM
> To: 'accessd at databaseadvisors.com'
> Subject: RE: [AccessD] TransferText Failling
>
>
> Seth,
> I happened to be writing a little routine to dump plan data to a text file
> so the mention of your code was very timely. Thanks! several comments: If
> the file doesn't exist the killfile line gives an error. I added a
filexists
> test. Second
> "Open strOutfile For Binary As intFileDesc" doesn't seem to work with the
> Print statement. I changed binary to Append and the code works.
>
> I need my amount field in the text file formatted as "-####.##"
but -2000.00
> is printed as -2000; 2000.20 is printed as 2000.2, etc. How can this be
> correctly formatted in the print statement?
> Regards,
> Jim Hale
>
> -----Original Message-----
> From: Seth Galitzer [mailto:sgsax at ksu.edu]
> Sent: Monday, March 10, 2003 1:32 PM
> To: accessd
> Subject: Re: [AccessD] TransferText Failling
>
>
> Rocky,
>
> Dump TransferText like a bad prom date and use file I/O manually to
> generate your text file.  You have much more control of the output and I
> have NEVER had it fail on me.  I've got sample code on my website.  Look
> under Downloads for "File I/O in VB".  There should be enough there to
> get you started.  I'd be happy to answer any questions if you have any.
>
> Seth
>
> On Mon, 2003-03-10 at 12:07, Rocky Smolin - Beach Access Software wrote:
> > Dear List
> >
> > I'm trying to use the TransferText method of exporting a table to a
comma
> delimited file.  I get "Error 3027: Cannot Update.  Database or object is
> read-only" when issuing:
> >
> > DoCmd.TransferText acExportDelim, , "tblAddRooms", varFileName
> >
> > where varFileName contains a valid path and file name.  Has anyone seen
> this before? I have but can't remember why or what the fix was.
> >
> > MTIA,
> >
> > Rocky Smolin
> > Beach Access Software
> >
> >
> --
> Seth Galitzer sgsax at ksu.edu
> Computing Specialist http://puma.agron.ksu.edu/~sgsax
> Dept. of Plant Pathology
> Kansas State University
>
> _______________________________________________
> 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
> _______________________________________________
> 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