|
Peter,
After checking our ADO code, we ended up defining all the fields as strings,
then using the VB functions of CDBL to change the string to a numeric field
for computations on the PC side. Be sure to Trim the field when you put it
into the string field. For Example:
Dim strRateAmt as String
Dim dblRateAmt as Currency
strRateAmt = Trim(AS400rs.Fields("RTAMT"))
dblRateAmt = CDbl(strRateAmt)
HTH,
Cyndi B.
Boise, ID
-----Original Message-----
From: Peter Dow [mailto:pcdow@MailAndNews.com]
I've got a VB program that's reading a file from an AS400 using ADO. Of the
following 3 lines
RateCode = AS400rs.Fields("RTCODE")
RateDesc = AS400rs.Fields("RTDESC")
RateAmt = AS400rs.Fields("RTAMT")
the first two work and the third one fails with run-time error 5 "Invalid
procedure call or argument". The left side fields are defined as
Dim RateAmt As Currency
Dim RateCode As String
Dim RateDesc As String
On the AS400, WRKDBF shows the fields defined as:
Seq. Base PF Field Name Field Description Key Tp Pos Len Dec
1.0 RATEP RTCODE 1 A 1 10
2.0 RTDESC A 11 50
3.0 RTAMT P 61 11 2
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.