TextBox

  • Thread starter Thread starter Barcode
  • Start date Start date
B

Barcode

Hello

May I get some help in programming on MS Access, the following code should
be inside a textbox in a form

=Sum("[small]";"table1") >= Sum("[big]";"table2")

Example
"[small]";"table1" = 10
"[big]";"table2" = 10

Code=
If Null >= 10 Show 0 of 10
If 10 >= null Show 10 of 0
If Null >= null Show 0 of 0
if 10 >= 10 Then Show with RED color 10 of 10
if 2 >= 10 Then Show 2 of 10

I appreciate your help,
thank you
 
Help me understand what you are doing as I am not familiar with the syntax
you are using --- =Sum("[small]";"table1") >= Sum("[big]";"table2")
 
I'm probably not the only person who is reluctant to open files from an
unknown source. You should be able to explain what you intend to accomplish
with:
=Sum("[small]";"table1") >= Sum("[big]";"table2")
You may be able to use DSum to total values from a table that is not in the
record source for your form or report. From VBA Help:
"You may want to use the DSum function when you need to display the sum of a
set of values from a field that is not in the record source for your form or
report."

However, you should know that comparison's to Null will fail. Null is not
zero. More information here:
http://allenbrowne.com/casu-11.html

In these examples from your original post, only the fourth one will evaluate
to True. You first three will produce an error, and the fifth one will be
false.
Code=
If Null >= 10 Show 0 of 10
If 10 >= null Show 10 of 0
If Null >= null Show 0 of 0
if 10 >= 10 Then Show with RED color 10 of 10
if 2 >= 10 Then Show 2 of 10

You can use the Nz function to replace Null with zero, if that is your
intention. Help has more information about Nz.
 
Just to clarify, I used the possessive where I meant to use a plural. This:
"However, you should know that comparison's to Null will fail."
should be:
"However, you should know that comparisons to Null will fail."

BruceM said:
I'm probably not the only person who is reluctant to open files from an
unknown source. You should be able to explain what you intend to
accomplish with:
=Sum("[small]";"table1") >= Sum("[big]";"table2")
You may be able to use DSum to total values from a table that is not in
the record source for your form or report. From VBA Help:
"You may want to use the DSum function when you need to display the sum of
a set of values from a field that is not in the record source for your
form or report."

However, you should know that comparison's to Null will fail. Null is not
zero. More information here:
http://allenbrowne.com/casu-11.html

In these examples from your original post, only the fourth one will
evaluate to True. You first three will produce an error, and the fifth
one will be false.
Code=
If Null >= 10 Show 0 of 10
If 10 >= null Show 10 of 0
If Null >= null Show 0 of 0
if 10 >= 10 Then Show with RED color 10 of 10
if 2 >= 10 Then Show 2 of 10

You can use the Nz function to replace Null with zero, if that is your
intention. Help has more information about Nz.


Barcode said:
Hello

Thank you for answering me.
In fact there is many questions on my project.

http://w5.nuinternet.com/s650100026/databas1.accdb

But for this question I asked, you can see on my files what I meant.

Thanks a lot
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top