473,387 Members | 1,423 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,387 software developers and data experts.

I need help with profit/loss for my database

I have a stock table with the cost price and the selling price, then i have an invoice that is produced. i need to produce a profit/loss for either daily, weekly or monthly i want to do this by drop down menu so as soon as e.g. weekly is selected it gives the profit/loss for that week. If there is a loss i wanted the loss to be displayed in red.
I'm totally newto using access i have to use it for my coursework and i need help if you need any more details please ask
Feb 19 '07 #1
2 3651
What you going to want to do is put your code in the change or after update event of the combo box. First you will need an IF statement to see if daily, weekly or monthly is selected. Then another IF statement within that one to compare the sell and buy cost to see if it is a profit or loss. Do the calculation and have your data output.

Hope this helps you, I prefer giving a general idea to help people play with code and learn. Also I am no good with code unless vb is helping me out by giving me what can go where, haha.
Feb 19 '07 #2
MMcCarthy
14,534 Expert Mod 8TB
tehgreatmg is right, you need to put code in the After Update event of your combobox (called cboTerm). If you have a textbox on the form called txtProfit, one called txtLoss and one called txtProfitLoss.

In the after update event you can calculate txtProfit, txtLoss and txtProfitLoss (Profit - Loss).

To make txtProfitLoss show red when there is a loss you will need to use conditional formatting on that textbox. In form design view click on the txtProfitLoss textbox and go to Format - Conditional Formatting and set the criteria for the colour change.

Mary
Feb 20 '07 #3

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

Similar topics

5
by: HotRod | last post by:
I am new to this so please go easy. We currently have some students doing some work on some web based tracking documents for us. They are currently using VB .net to develop what we requested....
6
by: blue875 | last post by:
A tale of two queries: One query looks like this, and runs fine. We'll call this the "Customer1 query": SELECT Customer1 overall.*, IIf(IsNull(.),0,1) AS IsField, IIf(IsNull(.),0,1) AS...
2
by: msbs48 | last post by:
Hi All very new to Access... having a problem with TransferText I am getting the message "Field 'NoName' doesn't exist in destination table" i saw a previous answer to this but it does not seem to...
0
by: U S Contractors Offering Service A Non-profit | last post by:
Brilliant technology helping those most in need Inbox Reply U S Contractors Offering Service A Non-profit show details 10:37 pm (1 hour ago) Brilliant technology helping those most in need ...
40
by: rdemyan via AccessMonster.com | last post by:
I have two databases, db1 and db2, with the same table, TableA. I want to select the records from TableA in db1 that have a LAST_UPDATE SomeDate. Then I want to get the identical records in TableA...
0
by: thegametb | last post by:
I got this wrestling database I'm developing. It's not as straight and narrow as most sport databases are, but this has got me stumped a bit. I am trying to implement their stats in to their specific...
2
by: Trev | last post by:
Hi, I need you suggestion and ideas as I am not a programmer by any means but I've been reading the articles on how to show a dynamic chart in asp web pages. I have to say it's brilliant and...
1
by: daniel | last post by:
Hello, I have limited understanding of js (css/html is more me) and when I run into complicated problems I am left undone. The person I normally call upon is on holiday so I was wondering if I...
0
Kosal
by: Kosal | last post by:
Dear All I would like everyone to help me to design database and form for my homework using vb.net create system cashbook for travel agent as bellow detail: * design database and form for...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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
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,...

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.