473,465 Members | 1,922 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

IsNull

I receive the foolwoing error in my report :
"You entered an expression that has no value"

In my report i am summing up the all orders with the control
=Sum([liters])
This control is called Bonus. I have then another control called
GrandTotal that calculates the bonus like that:

Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
Me![bonus] = Me![Sum] * rate
Me![TotalBonus] = Me![GrandTotal] * 5/100
End Sub

The report opens ok in case the bonus is not null.Otherwise i receive
the above message. I have tried the following code but with no suucess:

Private Sub Report_Open(Cancel As Integer)
If IsNull(Me![bonus]) Then
MsgBox " There are no orders ", vbExclamation
Me![bonus].Value = 0
Exit Sub
End If
End Sub

I cannot see why the IsNull command is not working.
Nov 12 '05 #1
4 5671
Use the Nz() function

=Sum(Nz([Liters],0)
or
=Sum(Nz([Liters],"")
or

If Nz(Me!Bonus,"") = "" Then ...
--

Danny J. Lesandrini
dl*********@hotmail.com
http://amazecreations.com/datafast
"Markus" <ge********@yahoo.com> wrote ...
I receive the foolwoing error in my report :
"You entered an expression that has no value"

In my report i am summing up the all orders with the control
=Sum([liters])
This control is called Bonus. I have then another control called
GrandTotal that calculates the bonus like that:

Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
Me![bonus] = Me![Sum] * rate
Me![TotalBonus] = Me![GrandTotal] * 5/100
End Sub

The report opens ok in case the bonus is not null.Otherwise i receive
the above message. I have tried the following code but with no suucess:

Private Sub Report_Open(Cancel As Integer)
If IsNull(Me![bonus]) Then
MsgBox " There are no orders ", vbExclamation
Me![bonus].Value = 0
Exit Sub
End If
End Sub

I cannot see why the IsNull command is not working.

Nov 12 '05 #2
Marcus, if there are no records in the report, the text box will have no
value. Attempting to sum or perform math on the non-existent value results
in Error (not Null).

Test the report's HasData property
Alternatively, IsError() with IIf() may help.
Or you may want to cancel the report's NoData event.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Markus" <ge********@yahoo.com> wrote in message
news:ea**************************@posting.google.c om...
I receive the foolwoing error in my report :
"You entered an expression that has no value"

In my report i am summing up the all orders with the control
=Sum([liters])
This control is called Bonus. I have then another control called
GrandTotal that calculates the bonus like that:

Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
Me![bonus] = Me![Sum] * rate
Me![TotalBonus] = Me![GrandTotal] * 5/100
End Sub

The report opens ok in case the bonus is not null.Otherwise i receive
the above message. I have tried the following code but with no suucess:

Private Sub Report_Open(Cancel As Integer)
If IsNull(Me![bonus]) Then
MsgBox " There are no orders ", vbExclamation
Me![bonus].Value = 0
Exit Sub
End If
End Sub

I cannot see why the IsNull command is not working.

Nov 12 '05 #3
On 24 Dec 2003 04:41:29 -0800, ge********@yahoo.com (Markus) wrote:

Perhaps you should ensure that the underlying query has no null
values. The Nz function is handy for that.

-Tom.

I receive the foolwoing error in my report :
"You entered an expression that has no value"

In my report i am summing up the all orders with the control
=Sum([liters])
This control is called Bonus. I have then another control called
GrandTotal that calculates the bonus like that:

Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
Me![bonus] = Me![Sum] * rate
Me![TotalBonus] = Me![GrandTotal] * 5/100
End Sub

The report opens ok in case the bonus is not null.Otherwise i receive
the above message. I have tried the following code but with no suucess:

Private Sub Report_Open(Cancel As Integer)
If IsNull(Me![bonus]) Then
MsgBox " There are no orders ", vbExclamation
Me![bonus].Value = 0
Exit Sub
End If
End Sub

I cannot see why the IsNull command is not working.


Nov 12 '05 #4
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Come on, youse guys! Yer ferget'in the NoData event.

If the query that is the report's RecordSource doesn't return any data
the NoData event will fire, if it exists. The OnOpen event occurs
BEFORE the RecordSource retrieves the data - that's why Markus' code
is not working - there isn't any data to work with. Try this as the
NoData event procedure:

Private Sub Report_NoData(Cancel As Integer)

MsgBox "No data fits the criteria of this report", vbCritical
Cancel = True

End Sub

HTH,

MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP+t6RIechKqOuFEgEQIArQCaAtoSKBSA0wQ2QWU+Weo2Ca bb0z4AoMsc
oMmAVqPg+H/9w1LdtOoLUA+0
=MxGy
-----END PGP SIGNATURE-----
Markus wrote:
I receive the foolwoing error in my report :
"You entered an expression that has no value"

In my report i am summing up the all orders with the control
=Sum([liters])
This control is called Bonus. I have then another control called
GrandTotal that calculates the bonus like that:

Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
Me![bonus] = Me![Sum] * rate
Me![TotalBonus] = Me![GrandTotal] * 5/100
End Sub

The report opens ok in case the bonus is not null.Otherwise i receive
the above message. I have tried the following code but with no suucess:

Private Sub Report_Open(Cancel As Integer)
If IsNull(Me![bonus]) Then
MsgBox " There are no orders ", vbExclamation
Me![bonus].Value = 0
Exit Sub
End If
End Sub

I cannot see why the IsNull command is not working.


Nov 12 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Bob Cottis | last post by:
I am getting wierd behaviour with IsNull in ASP. I am passing a string (which may be null) to a function. When the string is null, IsNull seems to return false the first time it is called, then...
2
by: Trev | last post by:
I have two tables, tblMTO and tblIMPORT_MTO. If I import an entire MTO into the import table I want to create a delta from it (i.e. leave only the changed items). I have a view (simplified) ...
6
by: Martin | last post by:
Dear Group Just wondered how I can avoid the CHAR(32) to be inserted if @String1 is NULL? SET @String3 = ISNULL(@String1,'') + CHAR(32) + ISNULL(@String2,'') Thanks very much for your...
6
by: Eric J Owens | last post by:
TIA! I recently moved some forms from an a2k mdb file to an a2k adp. There is now an error when opening one of the forms 'the isnull function requires 2 arguments', but I only find references...
4
by: Paul Spratley | last post by:
Hi all Firstly this my first time posting to technical groups - so any mistakes I apologise for in advance. I am trying to count records in several secondary tables for the same run in a...
2
by: Raoul Watson | last post by:
I have used isNull statement for as long as I have used VB.. Recently I am devugging a program and it is very clear that the "IsNull" function sometimes would return a true even when the value is...
16
by: madeleine | last post by:
Please can someone help me, I think I may go mad with this one: Do While Not IsNull(CDate(FormatDateTime(rst!F1.Value, vbShortDate))) If IsNull(CDate(FormatDateTime(rst!F1.Value, vbShortDate)))...
2
by: Hexman | last post by:
Hello All, In SS EE I have nulls in a column. I want to select and eventually change to a zero (its a smallint column). I've tried selecting 'null', 'dbnull', etc. Then I read about the ISNULL...
4
by: jimm.sander | last post by:
Hello, Problem: Im using isnull() in vbscript to determine if a field returned from a ado object call is in fact null. The problem is when I use isnull in anything other than a response.write()...
16
kcdoell
by: kcdoell | last post by:
Hello: When I write new record I have the following code: Private Sub Form_BeforeUpdate(Cancel As Integer) Me!RowIsActive = False 'When a user is creating a new record the following...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.