SQL Statement for Invoice_Header Query:
Expand|Select|Wrap|Line Numbers
- SELECT [Forms]![Form1]![Invoice_ID] AS inv_id, [Forms]![Form1]![Trans_Date] AS tran_date, Sum(Item_Lot_Query.total_gross) AS total_gross
- FROM Item_Lot_Query;
Expand|Select|Wrap|Line Numbers
- SELECT Invoice_Raw_Data.Trans_Date, Invoice_Raw_Data.Item_Num, Mid$([Invoice_Raw_Data]![Item_Num],6,7) AS gpitem, GL_Codes.[gl dsitribution], Invoice_Raw_Data.Lot_Code, Invoice_Raw_Data.Shipped_Qty, IIf([Invoice_Raw_Data]![Tot_Gross Amt]=0,0.01,[Invoice_Raw_Data]![Tot_Gross Amt]) AS total_gross, Invoice_Raw_Data.[Order_Type Code]
- FROM GL_Codes INNER JOIN Invoice_Raw_Data ON GL_Codes.Item = Invoice_Raw_Data.Item_Num
- WHERE (((Invoice_Raw_Data.[Order_Type Code])<>"INTL") AND ((Invoice_Raw_Data.Charge_To)<>"") AND ((Invoice_Raw_Data.[Reason Code])="SALE"))
- ORDER BY Mid$([Invoice_Raw_Data]![Item_Num],6,7), Invoice_Raw_Data.Lot_Code;
When I run the queries with the From1 open and data entered, I get tables just how I want them.
When I run the following VB code I get the CSV file below
Expand|Select|Wrap|Line Numbers
- Private Sub Command11_Click()
- On Error GoTo Err_Command11_Click
- Dim stExpName1 As String
- Dim strFile1 As String
- stExpName1 = "Invoice_Header_Query"
- strFile1 = "d:\GP_Project\Output\Invoice_header.csv"
- strExportSpec1 = "Export1"
- DoCmd.TransferText acExportDelim, TableName:=stExpName1, FileName:=strFile1, HasFieldNames:=True
- Exit_Command11_Click:
- Exit Sub
- Err_Command11_Click:
- MsgBox Err.Description
- Resume Exit_Command11_Click
- End Sub
Inv_ID is Jun_08
Trans_date is 6/30/2008
The CSV file looks like this:
"inv_id","tran_ date","total_gr oss"
4A 00 75 00 6E 00 5F 00 30 00 38 00 ,00 00 00 00 A0 59 E3 40 ,18129108.99
It should look like:
"inv_id","tran_ date","total_gr oss'
"Jun_08","tran_ date",18129108. 99
My first question is: Why are my two parameters showing up in HEX(?) format? And how do I stop it.
Second question is, I want to set the text quallifier as {none} as can be done in the advanced export settings box. I did this and saved an export specification as Export1. When I run my export command with Export1 as the specification, I get an error:
"The data being exported does not match the format described in the Schema.ini file." I've read about this file a little bit in Microsofts KB, but I can't find it on my computer anywhere.
I would greatly appreciate any help with these problems.
Chad