Export()


" "

short Export(long QueryID, long FirstRow, long FirstCol, long LastRow, long LastCol, short Format,
 short StringDelimiter, short ColumnDelimiter, Boolean IncludeColHeadings, BSTR FileName, 
 [VARIANT DateTimeFormat])

Description

This function exports the specified range of rows and columns using the selected options to the targeted file. Call CompleteQuery() prior to calling this function if you have not retrieved row data for the rows that you want to export. An error message is returned if you attempt to export rows that have not been retrieved from the database.

Note:
The name of this function conflicts with the Microsoft Access 2.0 keyword Execute. If you are using MS Access 2.0, place square brackets [ ] around the function name.

Parameters

Name Description
QueryID The ID of the query, as returned from InitializeQuery().
FirstRow The first row that you want to include in the export. The value of a first row in a result set is 0.
FirstCol The first column that you want to include in the export. The value of the first column in a result set is 0.
LastRow The last row that you want to include in the export, or a negative one (-1) if all rows are included. The value of the actual last row in a result set is one less than the total number of rows.
LastCol The last column that you want to include in the export, or a negative one (-1) if all columns are included. The value of the actual last column in a result set is one less than the total number of columns.
IncludeColHeadings Use non-zero to include the column headings in the first row and zero to exclude them.
FileName A string containing the name of the file to which you want to write the export.
DateTimeFormat

Optionally, the format to use for date and time values. Valid values are:

0 -- ISO format
1 -- USA format
2 -- EUR format
3 -- JIS format
4 -- Windows Control Panel format. The default value is 4.

Format

Use one of the following to specify output format:

0 (RSEF_TEXT) -- The output file will be written in plain text format.
1 (RSEF_HTML) -- The output file will be written in HTML (Hypertext Markup Language) format, and the data will be organized in an HTML table.
2 (RSEF_CSV) -- The output file will be written in CSV (comma-separated values) format.
3 (RSEF_PCIXF) -- The output file will be written in PC/IXF format.
4 (RSEF_S370IXF) -- The output file will be written in System/370 IXF format.

StringDelimiter

Use one of the following to specify the string delimiter. This parameter is ignored if Format is RSEF_HTML:

0 (RSSD_NONE) -- No string delimiter is used
1 (RSSD_SINGLEQUOTE) -- Strings are delimited by a single quote character (')
2 (RSSD_DOUBLEQUOTE) -- Strings are delimited by a double quote character (")

ColumnDelimiter

Use one of the following to specify the column delimiter. This parameter is ignored if Format is RSEF_HTML:

0 (RSCD_SPACE) -- Columns are delimited by a space character ( )
1 (RSCD_TAB) -- Columns are delimited by a tab character (\t)
2 (RSCD_COMMA) -- Columns are delimited by a comma character (,)

Return Value

The return value will be zero if successful or non-zero if unsuccessful. If the return value is non-zero, you can call GetLastErrorString() or GetLastErrorType() to get additional error information. If the result set is empty or no rows have been retrieved from the database, non-zero is returned unless FirstRow equals 0 and LastRow equals -1 In this case, zero is returned and an empty file is written.

Related Tasks

CopyToClipboard()
ExportEx()