473,394 Members | 1,742 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

If statement help

I am doing a monthly report for a company in access. I am fairly new to access so I don't know a whole lot. The report was orginaly created in excel. one of the columns, accounts receivable, equals the previous days accounts receivalbe + time sales - Rec on Account. At the beginning of th month the Accounts Receivable equals the final day in the last month's. I am trying to create an if statement to check if it is null.
Here is what I kind of came up with
Accounts_Receivable: If(IsNull( [Accounts_Receivable]),[last_month]+[time_sales] - [rec_on_acc], [Accounts_Recievable] + [time_sales] - [rec_on_acc]

I don't even think this is close but PLEASE HELP!
Jul 3 '08 #1
6 1579
hjozinovic
167 100+
I am doing a monthly report for a company in access. I am fairly new to access so I don't know a whole lot. The report was orginaly created in excel. one of the columns, accounts receivable, equals the previous days accounts receivalbe + time sales - Rec on Account. At the beginning of th month the Accounts Receivable equals the final day in the last month's. I am trying to create an if statement to check if it is null.
Here is what I kind of came up with
Accounts_Receivable: If(IsNull( [Accounts_Receivable]),[last_month]+[time_sales] - [rec_on_acc], [Accounts_Recievable] + [time_sales] - [rec_on_acc]

I don't even think this is close but PLEASE HELP!
hey Ighovden,

I believe the best solution would be to have a running sum.
I'm talking about Reports here. If you're creating a report you can have a running sum field that would always have the latest 'sum'.
It would not matter wether the sum is from previous month or not.

You can read more about creating a running sum in reports if you search MsAccess help for 'running sum'.

regards,
H.
Jul 3 '08 #2
Hey,
I think u create the report using Ms Access. In ms access report field, use the IIF statement instead of if statement u declared. Others in ur statements are correct.
Jul 3 '08 #3
hey Ighovden,

I believe the best solution would be to have a running sum.
I'm talking about Reports here. If you're creating a report you can have a running sum field that would always have the latest 'sum'.
It would not matter wether the sum is from previous month or not.

You can read more about creating a running sum in reports if you search MsAccess help for 'running sum'.

regards,
H.
Hi,
Thank you for the reply. My only proublem with a running sum is one of the equations for a field "Accounts_Receivable" incolvel more than one row. For example here is what it looked like in excel =(Y1 + V2) - W2 next cell down would look like this =(Y2+V3)-W3 Y in the Accounts receivalbe column V is Time_Sales and W is Rec_on_Acc. In Access the Accounts_Receivable field will start with the end of last months Accounts_Receivalbe, but if I type the equation Accounts_Receivable: Accounts_Recievable + Time_Sales - Rec_on_Acc it uses the Accounts_Receivalble on that row which is zero. it needs to use Accounts_Receivable in the above row and then use Time_Sales and Rec_on_Acc in the current row.
I hope this makes some sense. I had a hard time describing it in words. If this doesn't make sense I can try to reword it.
Thanks
Jul 3 '08 #4
ADezii
8,834 Expert 8TB
hey Ighovden,

I believe the best solution would be to have a running sum.
I'm talking about Reports here. If you're creating a report you can have a running sum field that would always have the latest 'sum'.
It would not matter wether the sum is from previous month or not.

You can read more about creating a running sum in reports if you search MsAccess help for 'running sum'.

regards,
H.
The general Logic would be:
Expand|Select|Wrap|Line Numbers
  1. IIf(IsNull([Accounts_Receivable]), 0, ([last_month] + [time_sales]) - [rec_on_acc])
Jul 3 '08 #5
Stewart Ross
2,545 Expert Mod 2GB
Hi. There are things that spreadsheets are much better at than databases - and one of them is the ability to generate row-by-row running sums. Databases can't easily mimic that kind of functionality, because the relational database model has no concept of record position.

If you look at how a spreadsheet does it, the running sum is adding the current cell to the previous value for that cell, all down a particular column. In spreadsheets, this relies on every row having a specific row and column position (or address). So, to produce a running total we add a new column and populate it with references to the previous cells (D2 = A2 + A1 for example, where A1 is a reference to the previous row's value). The key concept here is that every row of a spreadsheet has a reference number - which is not the case in a database.

Without the row referencing of the spreadsheet it is very difficult to describe the logic of the calculation in such a way that it can take place at all. The running sum for reports is a good example of how something like it can be achieved, but not easily within a general query.

Usually, to do a running sum in SQL involves self-joining a copy of a table to itself using some field (such as a date) to achieve a join of the current records to the previous one. It can be done, but is neither easy nor fast. It cannot be done using a simple lookup or built-in formula.

I would recommend exporting the data to Excel and using its flexibility to do such running SUMs - just as they were done originally. If you have access to the current total, as in your first posts and in subsequent responses, then you can obtain a total for your report - but it is an intermediate total of some kind rather than a running sum.

-Stewart
Jul 3 '08 #6
hjozinovic
167 100+
hey Ighovden,

I made a small base trying to get the result you are looking for.
I hope you will find it usefull.

H.
Attached Files
File Type: zip db1.zip (23.6 KB, 81 views)
Jul 4 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Robert Mark Bram | last post by:
Hi All! I have the following two methods in an asp/jscript page - my problem is that without the update statement there is no error, but with the update statement I get the following error: ...
4
by: James E Koehler | last post by:
I can't get the WHILE statement to work in MySQL. The version of MySQL that I am using is: Ver 12.16 Distrib 4.0.6-gamma, for Win95/Win98 (i32) running on Windows MX. Here is the relevant...
2
by: Little PussyCat | last post by:
Hello, I hope you can help me. We have a SQL Server 2000 database at work, (which works with a VB6 frontend) which grew to a considerable size, so one of my past colleagues sent me this...
5
by: WindAndWaves | last post by:
Hi Team The function below searches all the tables in a database. However, if subsearch = true then it searches all the objects listed in a recordset (which are all table names). I thought to...
11
by: Scott C. Reynolds | last post by:
In VB6 you could do a SELECT CASE that would evaluate each case for truth and execute those statements, such as: SELECT CASE True case x > y: dosomestuff() case x = 5: dosomestuff() case y >...
10
by: John Smith | last post by:
Can you do a Select Statement within a Select Statement? I want to build a query similar to queries built in Access which link to other queries but using only SQL Statements. Is it possible? If...
6
by: FayeC | last post by:
I really need help figuring this out. i have a db with mostly text fields but 2. The user_id field is an autonumber (key) and the user_newsletter is a number (1 and 0) field meaning 1 yes the ...
4
by: Jack | last post by:
Hi, I have a asp page where part of the code is as follows. This builds up the sql statement partially. sql01 = "UPDATE EquipmentTbl SET " sql01 = sql01 & "SerialNumber = '" &...
7
by: Steven Bethard | last post by:
I've updated PEP 359 with a bunch of the recent suggestions. The patch is available at: http://bugs.python.org/1472459 and I've pasted the full text below. I've tried to be more explicit about...
18
by: dspfun | last post by:
Hi! The words "expression" and "statement" are often used in C99 and C- textbooks, however, I am not sure of the clear defintion of these words with respect to C. Can somebody provide a sharp...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.