By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,404 Members | 2,145 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,404 IT Pros & Developers. It's quick & easy.

I need help with profit/loss for my database

P: 1
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
Share this Question
Share on Google+
2 Replies

P: 49
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

Expert Mod 10K+
P: 14,534
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.

Feb 20 '07 #3

Post your reply

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