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 » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

#Div/0! Message Driving me mad!!!



 
 
Thread Tools Display Modes
  #1  
Old November 29th, 2006, 09:27 AM posted to microsoft.public.access.forms,microsoft.public.access.formscoding
SG
external usenet poster
 
Posts: 50
Default #Div/0! Message Driving me mad!!!

I have a text box on my form and I keep getting the above error I understand
why I am getting this and that is not a problem, I just need to stop it from
displaying

This is the control source of the text box which is called SubTotal

=IIf(IsNull([SubTotal]),Null,CCur(Round([SubTotal]/(VAT.Column(1)))))

Please help!!!!!!!


Thank you all in advance.

S


--
www.sg-consultancy.co.uk


  #2  
Old November 29th, 2006, 10:44 AM posted to microsoft.public.access.forms,microsoft.public.access.formscoding
Stefan Hoffmann
external usenet poster
 
Posts: 709
Default #Div/0! Message Driving me mad!!!

hi,

SG wrote:
I have a text box on my form and I keep getting the above error I understand
why I am getting this and that is not a problem, I just need to stop it from
displaying

This is the control source of the text box which is called SubTotal

=IIf(IsNull([SubTotal]),Null,CCur(Round([SubTotal]/(VAT.Column(1)))))

When using IIf, all parameters are evaluated, cause it is a function not
a syntax element like If.

Use

=IIf(IsNull([SubTotal]),
Null,
IIf(Nz(VAT.Column(1),0) = 0,
Null,
CCur(Round([SubTotal]/(VAT.Column(1))))
)
)

mfG
-- stefan --

  #3  
Old November 29th, 2006, 11:17 AM posted to microsoft.public.access.forms,microsoft.public.access.formscoding
SG
external usenet poster
 
Posts: 50
Default #Div/0! Message Driving me mad!!!

Hi Stefan,

Thanks for that it worked a treat but has caused another little problem, I
have a text box with the following as the control source
=nz([total],0)-nz([sub total],0) this used to give the the VAT amount i.e.
the difference between the = VAT amount.

Now that I have changed the control source of the sub total text box if
there is nothing in the sub total then the total box diplays in the VAT text
box.

I suppose what I need to happen is if there is null in the Sub total text
box then the VAT text box should also be 0 how can I do this?

Thank you for your help!!



"Stefan Hoffmann" wrote in message
...
hi,

SG wrote:
I have a text box on my form and I keep getting the above error I
understand why I am getting this and that is not a problem, I just need
to stop it from displaying

This is the control source of the text box which is called SubTotal

=IIf(IsNull([SubTotal]),Null,CCur(Round([SubTotal]/(VAT.Column(1)))))

When using IIf, all parameters are evaluated, cause it is a function not a
syntax element like If.

Use

=IIf(IsNull([SubTotal]),
Null,
IIf(Nz(VAT.Column(1),0) = 0,
Null,
CCur(Round([SubTotal]/(VAT.Column(1))))
)
)

mfG
-- stefan --



  #4  
Old November 29th, 2006, 01:05 PM posted to microsoft.public.access.forms,microsoft.public.access.formscoding
Stefan Hoffmann
external usenet poster
 
Posts: 709
Default #Div/0! Message Driving me mad!!!

hi,

SG wrote:
I suppose what I need to happen is if there is null in the Sub total text
box then the VAT text box should also be 0 how can I do this?

Use

=IIf(IsNull([sub total]);Null;nz([total],0)-nz([sub total],0))

mfG
-- stefan --
  #5  
Old November 29th, 2006, 01:33 PM posted to microsoft.public.access.forms,microsoft.public.access.formscoding
SG
external usenet poster
 
Posts: 50
Default #Div/0! Message Driving me mad!!!

Stefan,

I gett #Name? after setting this as the control source.
=IIf(IsNull([sub total]);Null;nz([total],0)-nz([sub total],0)) as apposed
to =nz([total],0)-nz([sub total],0)


Any IDeas?




"Stefan Hoffmann" wrote in message
...
hi,

SG wrote:
I suppose what I need to happen is if there is null in the Sub total text
box then the VAT text box should also be 0 how can I do this?

Use

mfG

-- stefan --



  #6  
Old November 29th, 2006, 01:38 PM posted to microsoft.public.access.forms,microsoft.public.access.formscoding
SG
external usenet poster
 
Posts: 50
Default #Div/0! Message Driving me mad!!!

Stefan,

Thank you for your help!!

All now working as I would like!

Thanks again!



"SG" wrote in message
...
Stefan,

I gett #Name? after setting this as the control source.
=IIf(IsNull([sub total]);Null;nz([total],0)-nz([sub total],0)) as apposed
to =nz([total],0)-nz([sub total],0)


Any IDeas?




"Stefan Hoffmann" wrote in message
...
hi,

SG wrote:
I suppose what I need to happen is if there is null in the Sub total
text box then the VAT text box should also be 0 how can I do this?

Use

mfG

-- stefan --





 




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 07:33 PM.


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