Thanks Brian
Very useful response, as always.
I'll try that approach.
Mark
On 24 Jul 2003 at 18:39, Brian Wrigley wrote:

> Hi Mark,
> 
> If the data field is null, and ImpSalePrice is numeric, you'll get an
> exception when it tries to do the assignment. Try assigning the function
> result to a variant and if you don't get an exception doing that, then use
> vartype to find out exactly what it's returning. If it's simply returning a
> null value, that just means the field hasn't been initialised so might as
> well make the price zero. Otherwise, it should at least give you enough info
> to show what's going wrong and where the real problem might be.
> 
> I also seem to remember getting exceptions from either Locate or Lookup when
> you gave it a string key value that was longer than the data field...
> 
> Regards,
> Brian
> 
> ----- Original Message -----
> From: <[EMAIL PROTECTED]>
> To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]>
> Sent: Thursday, July 24, 2003 5:46 PM
> Subject: Re: [DUG]: Invalid Variant Type Conversion
> 
> 
> > Yes (so the conversion error is assigning null to a currency type,
> SalePrice??)
> > The next step was to test to see if ImpSalePrice was null.
> > Can I not do that?
> > Mark
> > On 23 Jul 2003 at 22:39, Moises Lopez wrote:
> >
> > > mark
> > >
> > > could it be that the SaleRefTable.Lookup somehow is returning null?
> > >
> > > cheers
> > > moises
> > >
> > > At 11:09 AM 7/24/2003 +1200, you wrote:
> > >
> > > >I am getting an Invalid variant type conversion in the following code:
> > > >
> > > >    ImpSalePrice := SaleRefTable.Lookup(
> > > >       'CustCode;DestCode;PricePoint;SpeciesCode;LogGrade;LogLength',
> > > >       VarArrayOf([pCustCode, pDestCode, pPricePoint, pSpeciesCode,
> pLogGrade,
> > > >       pLogLength]), 'SalePrice');
> > > >
> > > >I can't understand it because there is no error with the following:
> > > >
> > > >    if SaleRefTable.Locate(
> > > >       'CustCode;DestCode;PricePoint;SpeciesCode;LogGrade;LogLength',
> > > >       VarArrayOf([pCustCode, pDestCode, pPricePoint, pSpeciesCode,
> pLogGrade,
> > > >       pLogLength]), []) then
> > > >
> > > >I have check each of the types in the array and they match those in the
> > > >table.  Can
> > > >anyone point me to what is happening here?
> > > >
> > > >TIA
> > > >
> > > >Mark
> > >
> >---------------------------------------------------------------------------
> > > >     New Zealand Delphi Users group - Delphi List -
> [EMAIL PROTECTED]
> > > >                   Website: http://www.delphi.org.nz
> > > >To UnSub, send email to: [EMAIL PROTECTED]
> > > >with body of "unsubscribe delphi"
> > > >Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
> > > >
> > > >
> > > >---
> > > >Incoming mail is certified Virus Free.
> > > >Checked by AVG anti-virus system (http://www.grisoft.com).
> > > >Version: 6.0.495 / Virus Database: 294 - Release Date: 6/30/2003
> > >
> >
> >
> > --------------------------------------------------------------------------
> -
> >     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> >                   Website: http://www.delphi.org.nz
> > To UnSub, send email to: [EMAIL PROTECTED]
> > with body of "unsubscribe delphi"
> > Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
> 
> ---------------------------------------------------------------------------
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED] 
> with body of "unsubscribe delphi"
> Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
> 


---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to