I have the following VB code that I'm trying to create a text file if the results from the SQL query is greater than zero.
Here's a screenshot of my error i'm getting.
http://picasaweb.google.com/joefonseca79/WORK#5358052504135380098
The error is on Line 31 Char 1 :(
_________________________
***** Code below *****
_________________________
'***** Used to test if there is data for sales assignment, it creates a file with the count of records.
'***** Dated 07/13/09
set fso=WScript.CreateObject("Scripting.FileSystemObject")
vDirectoryBase=mid(WScript.ScriptFullName,1,len(WScript.ScriptFullName)-len(WScript.ScriptName))
Dim fso, f1
vRunDate=formatdatetime(now,vbShortDate)
Set Conn=WScript.CreateObject("ADODB.Connection")
conn.ConnectionString="dsn=QBCUDB;Connect Timeout=0;Command Timeout=0"
conn.Open
conn.CommandTimeout=999999
IF err.number<>0 THEN vError="Connection cannot be established" else
set RsDet=WScript.CreateObject("ADODB.RecordSet")
set Rs=WScript.CreateObject("ADODB.RecordSet")
' ****************** Summary 1 - test files
RsDet.Open "SELECT COUNT( SAPDW.DW_BILLTO.BILLTO_NAME ) FROM SAPDW.DW_CALENDAR, SAPDW.DW_BILLTO, SAPDW.DW_COMPANY, SAPDW.DW_LINE_TYPE, SAPDW.DW_SALES, SAPDW.DW_CURRENCY_RATE CURRENCY_RATE_BUS_DAYS WHERE ( SAPDW.DW_SALES.LINE_TYPE_SK=SAPDW.DW_LINE_TYPE.LINE_TYPE_SK ) AND ( SAPDW.DW_CALENDAR.DATE_KEY=SAPDW.DW_SALES.GL_DATE_SK ) AND ( SAPDW.DW_SALES.BILLTO_SK=SAPDW.DW_BILLTO.BILLTO_SK ) AND ( SAPDW.DW_BILLTO.BILLTO_RECORD = 'Y' ) AND ( SAPDW.DW_COMPANY.COMPANY_SK=SAPDW.DW_SALES.COMPANY_SK ) AND ( CURRENCY_RATE_BUS_DAYS.CURRENCY_TYPE='EURXYTD' AND SAPDW.DW_SALES.COMPANY_CURRENCY=CURRENCY_RATE_BUS_DAYS.CURRENCY_FROM ) AND ( SAPDW.DW_CALENDAR.SALES_CUR_YEAR=CURRENCY_RATE_BUS_DAYS.FISCAL_YR ) AND ( SAPDW.DW_CALENDAR.SALES_CUR_MONTH=CURRENCY_RATE_BUS_DAYS.MONTH_NBR ) AND ( SAPDW.DW_BILLTO.BILLTO_NBR <> 0 AND SAPDW.DW_BILLTO.SUB_CHANNEL_CODE In ( '10','20','30' ) AND SAPDW.DW_BILLTO.CUSTOMER_GROUP5_CODE = ' ' AND SAPDW.DW_COMPANY.COMPANY_CODE = 'FOIN' AND SAPDW.DW_LINE_TYPE.LINE_TYPE_CODE In ( 'GR','ZR','DR','CD','AR' ) )", conn
'--'OPTR'
IF RsDet = 0 THEN
'***** Create file *****
Set fso = CreateObject("Scripting.FileSystemObject")
Set f1 = fso.CreateTextFile("C:\Documents and Settings\jfonseca\My Documents\Business Objects\EVENTS\FOIN.txt", True)
END IF
'rs.close
rsDet.close
'END IF
Nenhum comentário:
Postar um comentário