[thelist] Need some Access Help

Casey Crookston caseyc at IntelliSoftmn.com
Thu May 31 22:05:13 CDT 2007


I am trying to decipher a line of code in an Access application.  It
looks like a label who's text has been assigned the following value:

=IIf(IsNull(DSum("[SumOfPoints Earned]","Total Points
Earned")),0,DSum("[SumOfPoints Earned]","Total Points Earned"))

This Access application has a table called [Supplier Ledger] which has a
column called [Points Issued].  From what I can tell, logically, this
line of code displays a sum of that column.  By logically, I mean, this
is what I would assume, based on the function of the application, and
not from looking at the line of code.

Here's the thing.  I am in the process of migrating this Access
application from Access to SQL 2005 with a web based .NET 2.0
application.  When I import this same table, [Supplier Ledger], and then
do a SUM on the column [Points Issued], I get a different value then
what the Access application gives.  I've checked, double checked, and
triple checked the actual raw data.  They are identical. So I dug into
the access application thinking I would find a neat little SELECT query
with a WHERE filter that I could replicate.  Instead I find this line of
code, which, admittedly,  I really don't know how to decipher.

Going though it piece by piece:  

1)	Why the double I's  on the IIF?

2)	I understand the IsNull(a,b) statement - that's the same in an
SQL query

3)	Over all it looks like: If(a,b,c). I think this could be
translated to: IF 'a' THEN 'b' ELSE 'c'.  Correct? Only here, 'a' seems
to be the as 'c' minus the IsNull statement. So, and I'm guessing here:
IF 'a' is null THEN display '0' ELSE display 'SumOfPoints Earned'

4)	Only, what is SumOfPoints Earned?  This does not seem to
correspond to the database table's name or the column name.  

5)	How does "Total Points Earned" fit in?

Anyway, enough rambeling.  Any help would be wonderful.  Thank you!

Casey




More information about the thelist mailing list