[AccessD] Nz and Val

Charlotte Foust charlotte.foust at gmail.com
Sat Jun 4 10:26:57 CDT 2011


Both + and & work as concatenation operators on strings.

Charlotte Foust

On Sat, Jun 4, 2011 at 8:13 AM, Tony Septav <iggy at nanaimo.ark.com> wrote:

> Hey Charlotte
> Thanks.
> No I got that what I dont' understand is why
>
>
> Msgbox Me!InvoiceAmount + Nz(Me!TotalInvoice,0) it displays 1000
> Gives me the correct total rather then an error message.
>
>
>
> Charlotte Foust wrote:
>
>  As far as I recall, Nz returns a string, so the display 800900 is the
>> concatenation of two strings. You have to convert the result with the
>> Val()
>> function to make it work properly in calculation.
>> Charlotte Foust
>>
>>
>> On Sat, Jun 4, 2011 at 7:49 AM, Tony Septav <iggy at nanaimo.ark.com> wrote:
>>
>>
>>
>>> Hey All
>>> Spent the last couple of hours testing the problem. I  very rarely use
>>> Nz.
>>> This doesn't work
>>>
>>> A)If Me!InvoiceAmount + Nz(Me!TotalInvoice, 0) > Nz(Me!Budget, 0) Then
>>> ..... display Yes/No message
>>> End If
>>>
>>> But this does
>>> B) If Me!InvoiceAmount + val(Nz(Me!TotalInvoice, 0)) > val(Nz(Me!Budget,
>>> 0)) Then
>>> ..... display Yes/No message
>>> End If
>>>
>>> And it (the Duh the light finally came on) makes sense TotalInvoice and
>>> Budget are numbers pulled from a ComboBox. If they are null display a
>>> zero,
>>> otherwise display the number which is text not numeric.
>>>
>>> Just curious again, what I don't understand is if I do
>>> 1. Msgbox Me!InvoiceAmount + Nz(Me!TotalInvoice,0) it displays 1000
>>> 2. Msgbox Nz(Me!TotalInvoice,0)+ Nz(Me!TotalInvoice,0) it displays 800900
>>> With 1. The total is correct but I would have thought I would have gotten
>>> an error message instead when trying to add a value to text??  Which is
>>> why
>>> A) above doesn't work.
>>>
>>> Thanks Again
>>>
>>>
>>>
>>>>
>>>>
>>>>
>>> --
>>> AccessD mailing list
>>> AccessD at databaseadvisors.com
>>> http://databaseadvisors.com/mailman/listinfo/accessd
>>>
>>>
>>>
>>>
>>> Website: http://www.databaseadvisors.com
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
>
>
> Website: http://www.databaseadvisors.com
>
>
>



More information about the AccessD mailing list