schema.ini specifications 
Author Message
 schema.ini specifications

I'm trying to find the specification options for the
schema.ini file so I can export text files using the
transfertext method. Specifically I want space delimited
and text qualifier of <none>.

If anyone can refer me to this info I will be very happy.

Thanks in advance.



Tue, 22 Nov 2005 10:14:18 GMT  
 schema.ini specifications

Quote:
> I'm trying to find the specification options for the
> schema.ini file so I can export text files using the
> transfertext method. Specifically I want space delimited
> and text qualifier of <none>.

I think I've seen that somewhere, but wouldn't it be easier to create an
import/export specification and use that in your call to the
TransferText method?

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)



Tue, 22 Nov 2005 11:48:23 GMT  
 schema.ini specifications
Yes, that was my original method, however, I am getting an
error that I have not been able to resolve when trying to
use the export specification in the DoCmd TransferText
method:

Error 3011: The Microsoft Jet database engine could
not find the object <filename>#<ext>. Make sure the object
exists and that you spell its name and the path name
correctly.

The filename I specify with complete path is
stored correctly to the string variable I assign, however,
when I run the TransferText method in my Access2000 module
I get this error. I tried creating a new specification to
no avail. I also am using the same specification for batch
exporting data from multiple files.

Creating the schema.ini file programatically I suspect is
the only long term solution.

Quote:
>-----Original Message-----


>> I'm trying to find the specification options for the
>> schema.ini file so I can export text files using the
>> transfertext method. Specifically I want space delimited
>> and text qualifier of <none>.

>I think I've seen that somewhere, but wouldn't it be
easier to create an
>import/export specification and use that in your call to
the
>TransferText method?

>--
>Dirk Goldgar, MS Access MVP
>www.datagnostics.com

>(please reply to the newsgroup)

>.



Wed, 23 Nov 2005 00:44:46 GMT  
 schema.ini specifications

Quote:
> Yes, that was my original method, however, I am getting an
> error that I have not been able to resolve when trying to
> use the export specification in the DoCmd TransferText
> method:

> Error 3011: The Microsoft Jet database engine could
> not find the object <filename>#<ext>. Make sure the object
> exists and that you spell its name and the path name
> correctly.

> The filename I specify with complete path is
> stored correctly to the string variable I assign, however,
> when I run the TransferText method in my Access2000 module
> I get this error. I tried creating a new specification to
> no avail. I also am using the same specification for batch
> exporting data from multiple files.

> Creating the schema.ini file programatically I suspect is
> the only long term solution.

Hmm.  I don't know what's going on, so I can't really say if creating a
schema.ini file is the solution.  I've never had the problem you
describe.  Would you care to post the exact code you're using and the
details of the import/export specification?

It may be simpler just to export the file yourself, and sidestep the
TransferText method.  Dmitri Furman has posted a text export class at

    http://www.mvps.org/access/modules/mdl0058.htm

that you may like.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)



Wed, 23 Nov 2005 02:11:43 GMT  
 schema.ini specifications
Thanks for your help, however, I have successfully solved
my problem by creating the schema.ini in my code using the
function found at in the article:
http://support.microsoft.com/default.aspx?scid=kb;en-
us;210001

The schema.ini option I had difficulty finding was:
textdelimiter=none

This was needed because I have been converting all my
numeric fields to character strings in order fix the bug
in which numeric data is truncated at 2 decimal places in
the text file.

Creating the schema.ini on the fly actually is more suited
to my application as it allows me to batch export tables
to text files without error even if my table structures
are different or have been modified. I believe this is the
cause of the error I was encountering - using the
transfertext specification.

The code I am using also reads my table structure and
creates a querydef on the fly which converts numeric
fields to strings. I will include it below for the
possible benifit to others. (Note that I have commented
out the column format lines in the createschemafile
function because I did not require them, alternatively I
would have to replace the tabledef references to querydef
for my application).

Sub CSO_export(mktblname As String, mformat As Long)

    Dim dbsCurrent As Database
    Dim qdftempdef1 As QueryDef
    Dim tblDef As TableDef
    Dim mpath As String
    Dim moutfile As String
    Dim moutspec As String
    Dim msectname As String
    Dim mqrystring As String
    Dim flds, fld, i

    mpath = "C:\Data (E)\H & H Data\CSO Monitoring
Data\Input\TF\2003\"
    moutfile = mpath + mktblname + ".txt"

    Debug.Print mktblname

    Set dbsCurrent = CurrentDb()
    Set tblDef = dbsCurrent(mktblname)
    Set flds = tblDef.Fields

    'Note: this assumes that the first fieldname, Item(0)
= "DateTime"
    For i = 1 To flds.Count - 1
        If flds.Item(i).Type = 7 Or flds.Item(i).Type = 6
Then
            mqrystring = mqrystring + ", CStr([" +
flds.Item(i).Name + "])as s" + flds.Item(i).Name
        Else
            mqrystring = mqrystring + ", " + flds.Item
(i).Name
        End If
    Next i

    mqrystring = "SELECT DateTime" + mqrystring + " FROM "
+ mktblname + " WHERE ([DateTime] >= #7/1/2002#)"

    Set qdftempdef1 = dbsCurrent.CreateQueryDef("qrytemp",
mqrystring)
    dbsCurrent.QueryDefs.Refresh

    msectname = mktblname + ".txt"

    Call CreateSchemaFile(True, mpath,
msectname, "qrytemp")

    DoCmd.TransferText acExportDelim, , "qrytemp", moutfile

    DoCmd.DeleteObject acQuery, "qrytemp"

End Sub

Sub call_cso_export()

   CSO_export "F_03", 1
   CSO_export "F_04", 1
   CSO_export "F_05", 1
   CSO_export "F_06", 1

End Sub
'from http://support.microsoft.com/default.aspx?scid=kb;en-
us;210001
Public Function CreateSchemaFile(bIncFldNames As Boolean, _
                                 sPath As String, _
                                 sSectionName As String, _
                                 sTblQryName As String) As
Boolean
   Dim Msg As String ' For error handling.
   On Local Error GoTo CreateSchemaFile_Err
   Dim ws As Workspace, db As DAO.Database
   Dim tblDef As DAO.TableDef
   Dim fldDef As DAO.Field
   Dim i As Integer, Handle As Integer
   Dim fldName As String, fldDataInfo As String
   ' -----------------------------------------------
   ' Set DAO objects.
   ' -----------------------------------------------
   Set db = CurrentDb()
   ' -----------------------------------------------
   ' Open schema file for append.
   ' -----------------------------------------------
   Handle = FreeFile
   Open sPath & "schema.ini" For Output Access Write As
#Handle
   ' -----------------------------------------------
   ' Write schema header.
   ' -----------------------------------------------
   Print #Handle, "[" & sSectionName & "]"
   Print #Handle, "ColNameHeader = " & _
                   IIf(bIncFldNames, "True", "False")
   Print #Handle, "CharacterSet = ANSI"
   Print #Handle, "Format = CSVDelimited"
   Print #Handle, "TextDelimiter = none"
   ' -----------------------------------------------
   ' Get data concerning schema file.
   ' -----------------------------------------------
   'Set tblDef = db.TableDefs(sTblQryName)
   'With tblDef
   '   For i = 0 To .Fields.Count - 1
   '      Set fldDef = .Fields(i)
   '      With fldDef
   '         fldName = .Name
   '         Select Case .Type
   '            Case dbBoolean
   '               fldDataInfo = "Bit"
   '            Case dbByte
   '               fldDataInfo = "Byte"
   '            Case dbInteger
   '               fldDataInfo = "Short"
   '            Case dbLong
   '               fldDataInfo = "Integer"
   '            Case dbCurrency
   '               fldDataInfo = "Currency"
   '            Case dbSingle
   '               fldDataInfo = "Single"
   '            Case dbDouble
   '               fldDataInfo = "Double"
   '            Case dbDate
   '               fldDataInfo = "Date"
   '            Case dbText
   '               fldDataInfo = "Char Width " &
format$(.Size)
   '            Case dbLongBinary
   '               fldDataInfo = "OLE"
   '            Case dbMemo
   '               fldDataInfo = "LongChar"
   '            Case dbGUID
   '               fldDataInfo = "Char Width 16"
   '         End Select
   '         Print #Handle, "Col" & format$(i + 1) _
   '                         & "=" & fldName & Space$(1) _
   '                         & fldDataInfo
   '      End With
   '   Next i
   'End With
   'MsgBox sPath & "SCHEMA.INI has been created."
   CreateSchemaFile = True
CreateSchemaFile_End:
   Close Handle
   Exit Function
CreateSchemaFile_Err:
   Msg = "Error #: " & format$(Err.Number) & vbCrLf
   Msg = Msg & Err.Description
   MsgBox Msg
   Resume CreateSchemaFile_End
End Function

Best Regards!

Quote:
>-----Original Message-----


>> Yes, that was my original method, however, I am getting
an
>> error that I have not been able to resolve when trying
to
>> use the export specification in the DoCmd TransferText
>> method:

>> Error 3011: The Microsoft Jet database engine could
>> not find the object <filename>#<ext>. Make sure the
object
>> exists and that you spell its name and the path name
>> correctly.

>> The filename I specify with complete path is
>> stored correctly to the string variable I assign,
however,
>> when I run the TransferText method in my Access2000
module
>> I get this error. I tried creating a new specification
to
>> no avail. I also am using the same specification for
batch
>> exporting data from multiple files.

>> Creating the schema.ini file programatically I suspect
is
>> the only long term solution.

>Hmm.  I don't know what's going on, so I can't really say
if creating a
>schema.ini file is the solution.  I've never had the
problem you
>describe.  Would you care to post the exact code you're
using and the
>details of the import/export specification?

>It may be simpler just to export the file yourself, and
sidestep the
>TransferText method.  Dmitri Furman has posted a text
export class at

>    http://www.mvps.org/access/modules/mdl0058.htm

>that you may like.

>--
>Dirk Goldgar, MS Access MVP
>www.datagnostics.com

>(please reply to the newsgroup)

>.



Wed, 23 Nov 2005 04:21:49 GMT  
 schema.ini specifications

Quote:
> Thanks for your help, however, I have successfully solved
> my problem by creating the schema.ini in my code using the
> function found at in the article:
> http://support.microsoft.com/default.aspx?scid=kb;en-
> us;210001

> The schema.ini option I had difficulty finding was:
> textdelimiter=none

> This was needed because I have been converting all my
> numeric fields to character strings in order fix the bug
> in which numeric data is truncated at 2 decimal places in
> the text file.

> Creating the schema.ini on the fly actually is more suited
> to my application as it allows me to batch export tables
> to text files without error even if my table structures
> are different or have been modified. I believe this is the
> cause of the error I was encountering - using the
> transfertext specification.

Great, Gary, and thanks for posting the code.  I'm not surprised you
were having problems with the import/export specification if you the
table structures you were exporting didn't match the specification.
When you said you recreated the spec, I assumed that meant it did
conform to the table you were exporting.  Anyway, it appears that you've
found a good solution to your problem, so all is well.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)



Wed, 23 Nov 2005 04:43:44 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Schema.ini problem

2. Schema.ini Information

3. Help -- Schema.Ini file format

4. Can I avoid schema.ini in VB5?

5. Schema.INI

6. Dates in SCHEMA.INI

7. Text File Databases/Schema.ini Limitation

8. SCHEMA.INI Must I use this file name???

9. ODBC Text Driver -- Schema.INI Problem !

10. ODBC Text Driver -- Schema.INI Problem !

11. SCHEMA.INI

12. schema.ini: How can I use that Meta-File for the ODBC-Datasource-Administrator

 

 
Powered by phpBB® Forum Software