A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Update type conversion error with nulls



 
 
Thread Tools Display Modes
  #1  
Old December 18th, 2009, 06:01 AM posted to microsoft.public.access.queries
DonnaJN
external usenet poster
 
Posts: 1
Default Update type conversion error with nulls

I need to simply divide one currency value by another currency value. Sounds
simple????? Here are two sql statements I've tried. Most records are null,
it is only the ones that I want to update and close that will have a value in
Net_PL.

UPDATE Diagonal SET Diagonal.Final_ROR = IIf([Diagonal]![Net_PL] Is
Null,0,[Diagonal]![Net_PL]/[Diagonal]![Tr_Trade_Risk]);

UPDATE Diagonal SET Diagonal.Final_ROR =
Nz([Diagonal]![Net_PL])/Nz([Diagonal]![Tr_Trade_Risk]);

I get the error message "...didn't update x number of fields due to a type
conversion error......."

I don't know what else to try.




  #2  
Old December 18th, 2009, 12:20 PM posted to microsoft.public.access.queries
bhicks11 via AccessMonster.com
external usenet poster
 
Posts: 529
Default Update type conversion error with nulls

Is the field you are updating numeric?

Bonnie
http://www.dataplus-svc.com

DonnaJN wrote:
I need to simply divide one currency value by another currency value. Sounds
simple????? Here are two sql statements I've tried. Most records are null,
it is only the ones that I want to update and close that will have a value in
Net_PL.

UPDATE Diagonal SET Diagonal.Final_ROR = IIf([Diagonal]![Net_PL] Is
Null,0,[Diagonal]![Net_PL]/[Diagonal]![Tr_Trade_Risk]);

UPDATE Diagonal SET Diagonal.Final_ROR =
Nz([Diagonal]![Net_PL])/Nz([Diagonal]![Tr_Trade_Risk]);

I get the error message "...didn't update x number of fields due to a type
conversion error......."

I don't know what else to try.


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...eries/200912/1

  #3  
Old December 18th, 2009, 01:38 PM posted to microsoft.public.access.queries
Jerry Whittle
external usenet poster
 
Posts: 4,732
Default Update type conversion error with nulls

If you only want to update when the [Net_PL] has data, put Is Not Null in the
criteria to exclude the null records.

If there are any null or records with 0 in Tr_Trade_Risk, that could also
cause problems especially a divide by 0 error.

Another possibility, if it meets with your business rules, is to an update
query that changed the nulls in [Net_PL] to 0.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


"DonnaJN" wrote:

I need to simply divide one currency value by another currency value. Sounds
simple????? Here are two sql statements I've tried. Most records are null,
it is only the ones that I want to update and close that will have a value in
Net_PL.

UPDATE Diagonal SET Diagonal.Final_ROR = IIf([Diagonal]![Net_PL] Is
Null,0,[Diagonal]![Net_PL]/[Diagonal]![Tr_Trade_Risk]);

UPDATE Diagonal SET Diagonal.Final_ROR =
Nz([Diagonal]![Net_PL])/Nz([Diagonal]![Tr_Trade_Risk]);

I get the error message "...didn't update x number of fields due to a type
conversion error......."

I don't know what else to try.




  #4  
Old December 18th, 2009, 10:38 PM posted to microsoft.public.access.queries
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Update type conversion error with nulls

Try this --
UPDATE Diagonal SET [Diagonal].[Final_ROR] = IIF([Diagonal].[Net_PL] Is Null
OR [Diagonal].[Net_PL] = 0 OR [Diagonal].[Tr_Trade_Risk] Is Null OR
[Diagonal].[Tr_Trade_Risk] = 0, [Diagonal].[Final_ROR],
[Diagonal].[Net_PL]/[Diagonal].[Tr_Trade_Risk]);


--
Build a little, test a little.


"DonnaJN" wrote:

I need to simply divide one currency value by another currency value. Sounds
simple????? Here are two sql statements I've tried. Most records are null,
it is only the ones that I want to update and close that will have a value in
Net_PL.

UPDATE Diagonal SET Diagonal.Final_ROR = IIf([Diagonal]![Net_PL] Is
Null,0,[Diagonal]![Net_PL]/[Diagonal]![Tr_Trade_Risk]);

UPDATE Diagonal SET Diagonal.Final_ROR =
Nz([Diagonal]![Net_PL])/Nz([Diagonal]![Tr_Trade_Risk]);

I get the error message "...didn't update x number of fields due to a type
conversion error......."

I don't know what else to try.




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:12 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.