converting positive number to negative

Y

yoshimarine

I am in need of some help with coding a form control to convert a number from
positive to negative. I have had very little experience with Access, so I
don't know much about the actual writing the code out. I have a form that
will record either a debit which needs to be a negative number and another
field that is the credit which is positive. Any help will be appreciated.
 
R

Rick Brandt

yoshimarine said:
I am in need of some help with coding a form control to convert a
number from positive to negative. I have had very little experience
with Access, so I don't know much about the actual writing the code
out. I have a form that will record either a debit which needs to be
a negative number and another field that is the credit which is
positive. Any help will be appreciated.

You could just use a validation rule of < 0 so that the user is forced to
make the entry a negative number.

Otherwise in the AfterUpdate event you could use...

Me.ControlName = Abs(Me.ControlName) * -1
 
B

Bob Quintal

I am in need of some help with coding a form control to convert a
number from positive to negative. I have had very little
experience with Access, so I don't know much about the actual
writing the code out. I have a form that will record either a
debit which needs to be a negative number and another field that
is the credit which is positive. Any help will be appreciated.

how are you storing the indicator for debit/credit?
If text you could do
If me.txtcreditDebit ="debit" then
me.amt = me.amt *-1
end if
in the after update of the amount and debitcredit fields.

if you are using a checkbox, it's even simpler,
if me.chkdebit then amt = amt *-1

Your next question will probably be where to use the code. I don't
know what you intend to do, and there are many options, so i'll wait
until you supply more info.
 

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