How to Automatically Multiply number within the same box???

A

Adam - Regus

Hi there,


I'm new to Access and am trying to create a form to use to bill
clients. One of the boxes is a "COURIER" box and what I want to be
able to do is type in the cost of the courier package ie.$10.00 and
have it automatically mulitplied by a set amount ie. 1.5 (50% markup)
so that all that will show will be $15.00 in the box.
I can figure out how to do this easily with 2 boxes, but I don't want
my clients knowing what the markup is.


Can anyone help???


Thanks,
Adam
Regus
 
R

Rick B

Why would your clients see this field? If you have a cost field and a sell
field, you would not show customers the cost field. That does not mean that
you can't store both values though.

In the reports that you print for your clients, don't include the cost
field. Just the calculated field in an unbound text box.

In the courier charge text box on the report, put...


=[courier]*1.50
 
G

Guest

Hey Adam, though I don't recommend you setting up your db this way, you can
do this by placing the following code in the After Update event of the text
box:

txtMarkup.Value = txtMarkup * 1.5

This takes the value inputed into the textbox txtMarkup and multiplies the
value by 1.5.

Now on to my recommendation: I would leave the textbox as is in the form --
which should be for your use or employees use only. For your clients, create
a report with a field that does the calculation on the fly. This way, the
charge before markup is stored in a table--where the client cannot see
it--and the report contains only the information you want the client to see.
 
A

Adam - Regus

Right now, my manager has us prinout the forms, and give one copy to
the client, one we keep. I am going to suggest to my manager that we
prinout a report instead, but their entire system for billing is built
around printing the forms, so I'm stuck for now. And I don't know that
much about building databases, so I appreciate all the advice!

So Roach, when I copy and paste the code into the text box for "COURIER
COST", in the after update, I get the following error:

"The expression After Update you entered as the event property setting
produced the following error:The object doesn't contain the Automation
object 'text markup'.
* The expression may not result in the name of a macro, the name of a
user defined function, or [Event Procedure]
*There may have been an error evaluating the function, event, or macro.


FYI, I'm running Access 2000, so maybe the older version could be at
fault too?

thanks again,

Adam
 
R

Rick B

Note that forms are NOT designed for printing. You can make your report
look ALMOST EXACTLY like your form, but you should not be printing a form.
You do not have the print controls in a form that allow you to control how
it prints.
 
R

Rick B

Also note. If you add a button to your form and call it "Print
Confirmation" your manager should not care if that prints a report or a
form. Let your manager tell you what the end results should be, don't let
him tell you how to get there. That's your job to determine how to make it
work. Just make sure it meets his requirements.

If it were me, I'd build the report and make it pretty and let it do what
you need. I'd also point out that this allows you to STORE YOUR ACTUAL
COURIER COST as apposed to some funny number. What if your markup changes
in a year? You'll never be able to determine what your real cost was in the
past. If it were me, I'd store the cost AND I'd store the markup percent in
a separate field. You can default it to 50%, but I'd store it so it could
be changed when needed.

After I built the report, I'd add the button to the form to save the record
and send the report to the printer. I might even have it automatically send
two copies if that is what you want. This would all be much easier. If you
want to make it really really easy, just add code that automatically dumps
two copies of the report to the printer any time you add a new record
through your form.

In short, use the features as intended. Don't just keep doing things the
way someone (who obviously did not know Access) decided to do them in the
past. Printing a screen works, but would you write a letter in Word and
then screen print it? No!

Good luck,
 
R

Rick B

In the "access.forms" newsgroup, there is a thread that include the exact
code to print your report. The poster is asking how to make it print a
certain number of copies. Once he gets a response, this code will do almost
exactly what you need to do.

The topic is "print more than one copy of a report from a form". It was
posted by "michael" at 8:30 this morning.
 
G

Guest

Try this, assuming COURIER COST is the name of the textbox:

[COURIER COST].Value = [COURIER COST] * 1.5

If COURIER COST is not the name of your textbox, replace it with the correct
name.

Again, I recommend taking a different approach to elimate future headaches
related to this setup.

Rick B gave very good suggestions as well as an alternative approach.
 
A

Adam - Regus

Thank you all for your input! It seems like I'll be redesigning this
database, so that it prints the reports how we want them. But until
then, I ended up with one box for "ACTUAL COURIER COSTS" and one for
the marked up "COURIER COSTS" and used the display on screen for the
actual costs only. I know it's a backassward way of doing things, but
for now it will do. I'm basically the shipper/receiver/mailroom guy
here, so I don't really know that much about Access, but thanks to you
all, I'm learning.

Cheers,
Adam
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top