Re: ODBC/EXCEL


[ Follow Ups ] [ Post Followup ] [ Signature.net Forum ]

Posted by Jim Guerber on July 11, 2005 at 11:50:26:

In Reply to: Re: ODBC/EXCEL posted by Les Toeplitz on July 11, 2005 at 11:07:23:

I wrote an application that does the accounting for the local school's lunch program. The program accomplishes its input via hyperlink and/or bar code. The output for the catering group that does the lunches is through 3 excel spread sheets generated each day.

My code is far less sophisticated than Marc's elsewhere in this thread. I basically know that the strings do not contain commas and the numbers are not negative. Here is a little sample of my code:

! Accounts
tBalance = 0
tsales = 0
tcredits = 0
entry$ = 'B' + date$ + '.csv'
erase entry$,dir='isc',excp= ebok
ebok: create entry$,dir='isc',excp=baldone
close(10) & open(10)entry$
print(10)'Account,Balance,Sales,Credits'
position(Account) key = ''
nxtact:
read(Account,account) excp=baldone
tBalance = tBalance + Balance
tsales = tsales + sales
tcredits = tcredits + credits
print(10)aname$;',';_
Balance;',';_
sales;',';_
credits
goto nxtact
baldone:
print(10)'Totals,';_
tBalance;',';_
tsales;',';_
tcredits
close(10)

If I did not know about the contents of the variables, I would have coded a format like this:

Balance: format '"';aname$;'",';_
Balance,(lm);',';_
sales,(lm);',';_
credits,(lm)

I think that would work but I have not even compiled it.

Once the file is generated, I launch it:

entry$ = path('isc') + entry$
print (launch=entry$)

The whole trick is that extension of CSV. Windows knows that CSV files are processed by Excel, and thus launches excell when you launch the file.




Follow Ups:



Post a Followup

Name:
E-Mail:

Subject:

What is the name of the main Signature System's Product?

Comments:

Optional Link URL:
Link Title:
Optional Image URL:

You may attach up to 5 files to your followup (see below):






[ Follow Ups ] [ Post Followup ] [ Signature.net Forum ]