473,401 Members | 2,125 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,401 software developers and data experts.

How to see results in a table or report when using formula in a split form?

Can any body help me?
I am using ms access 2007, i have a problem regarding formula.
My form:
Table Name: Cellphone
Fields Name : "Cellphone List" "Cost" "Actual Cost" "Difference" "Percentage"

I am using a split form."Difference" and "Percentage" fields have formula.

Expand|Select|Wrap|Line Numbers
  1. Control Source of Difference "=[Actual Cost]-[Cost]"
  2. Control Source of Percentage "=[Cost]/[Actual Cost]"
It really works fine i can saw all results in split form including TOTALS but my main problem was i can't see results of "Difference" and Percentage" on a table
or if i make a WIZARD REPORT only "Cellphone List" "Cost" and "Actual Cost" have values but "Difference" and "Percentage" fields i cant see any value.
I thinks it is because the 2 fields have an equation? I dont really know what's the problem? Please help me to solve it.Thanks in advance
Jan 16 '12 #1
7 1621
C CSR
144 100+
Assuming you are set up to protect the data from input on the form (diff & percent) you can set up the following Form OnCurrent event and leave the fields control source alone (reset it to the fieldname in the dropbox):

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2. Me.diffence = Me.ActualCost - Me.Cost
  3. Me.percent = Me.Cost / Me.ActualCost
  4. End Sub
  5.  
The table will accept the calculation. Yu may have to run an update query accross the board or stroll through the records real quick to change the present data value. There are a few other ways using queries as your record source for the form. I'd rather manipulate it from the code.
Jan 16 '12 #2
C CSR
144 100+
Use the properties box for the whole "Form" in design mode, look at the Event tab, select the "..." next to "On Current" and insert the two inner lines above inside the subprocedure. Change the variable names I used, of course, to match your fieldnames. I hope this is clear for now.
Jan 16 '12 #3
NeoPa
32,556 Expert Mod 16PB
Nicole05:
It really works fine i can saw all results in split form including TOTALS but my main problem was i can't see results of "Difference" and Percentage" on a table
Why would that surprise you? You have formulas on controls in your form that show you these values in the form. You have nothing in your table that does anything similar. Why would the fact that the information which is on the form, is missing from the table be cause for thinking anything is wrong?

PS. Updating fields in your table should never be recommended by anyone who understands Normalisation (See Database Normalisation and Table Structures.) or working with any RDBMS. You should think very carefully before considering taking that course in any database design.
Jan 16 '12 #4
C CSR
144 100+
I meant only update to fix the preexisting condition. After that no update would be necessary.
Jan 16 '12 #5
NeoPa
32,556 Expert Mod 16PB
I'm not sure I follow clearly. I'm saying that [Difference] & [Percent] fields shouldn't even exist as they represent data that is already calculable from existing data. I didn't mean to be disparaging of your posts (as I've seen some of your good work), but Normalisation is such an important and fundamental issue that it needs to be highlighted wherever it comes up.
Jan 16 '12 #6
C CSR
144 100+
Quote from OP:
"but my main problem was i can't see results of "Difference" and Percentage" on a table."

The OP wants the results in a table, and didn't see making his calculations for other applications of his data somewhere down the road. Also, even if he uses my initial approach, he has some coding to do on the form controls (events) so that if he changes the value for Cost and Actual cost on the form, the Difference and Percentage controls would have to change with them.

I appreciate your mentorship.
Jan 16 '12 #7
NeoPa
32,556 Expert Mod 16PB
Whenever I see any question that pre-supposes a non-normalised approach (as in this case), I feel it's my duty to enlighten. Not only for the benefit of the member asking the question, but also for all the others who read the thread over time. That is not to say I won't help them go the wrong way if they are insistent, that is their choice ultimately, but I always explore first their understanding. This also ensures that the warnings are there before anyone else thinks any non-normalised approach is a correct solution. Nearly always it's simply lack of awareness that leads them to think that way.
Jan 16 '12 #8

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

Similar topics

3
by: Steven K | last post by:
Hello, I am using an asp page (upload.asp) to gather information and to upload files to the web server using SoftArtisans SAUpload Tool. In the first page (upload.asp), I have a form for...
0
by: Song, Jay | last post by:
I am sure if it's possible to do that, but I want to use mysqldump to backup my databases. However, there is only one large table I want to exclude. Can this be easily done? Thanks. Jay --...
0
by: Kim | last post by:
I have a crystal report that is using datasets and everytime I run the application a login screen pops up. Why is this? I went on the Crystal Reports Website and found this bit of code that...
0
by: RJN | last post by:
Hi I have a main report and a sub report. I have a formula field on the main report and one on the sub report. I want the formula in the subreport to be evaluated after the formula in the main...
1
by: mirela | last post by:
Hello, I'm using RedHat 9 and PostgreSQL 7.3.4. I have a table with a column of type varchar and length 250. This column includes both English and Hebrew text values. The following select...
2
by: RottNKorpse | last post by:
Well I am trying to make an admin section to allow my other admins of my site able to add content to my mysql database without giving them phpmyadmin access and without teaching them out to use it as...
1
by: qasimali84 | last post by:
I am developing a Cadiac Segment Evaluation System . In this system Patient Information is Kept in Master Table using Reg_No as Primary Key and the information about Seventeen Different segments of...
5
by: josecruz | last post by:
Hello, I have looked all over on the previous postings to attempt to solve a problem that I have when generating a report. The report provides counts and averages form several queries that are...
1
by: tomlebold | last post by:
Having problems displaying query results from combo boxes on a sub form, which is on the same form that is used to select criteria. This has always worked form me when displaying query results on...
13
by: geosmy | last post by:
Hi everyone, First post here! I have been trying to upgrade to Acc2007 looking forward to using Split Forms. To my horror I have just discovered that Split Forms do not hold variables at...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
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...

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.