IS it possible to convert the selected number in a drop down list to negative?

shabbaranks

Registered User.
Local time
Today, 19:36
Joined
Oct 17, 2011
Messages
300
Hi all...

On occasion users might need to add a negative value to a form. Currently they have a drop down list of numbers, is there anyway to either add a tick box or button which will convert that number to a negative value?

Hope I make sense, thanks :)
 
Why not store the negative numbers in the drop down? Is the drop down looking up its values from a predefined value list or from a table/query?
 
Its looking up its list from a pre-defined table. So I could just add the numbers to the list but the list would be quite long, I was hoping to be able to convert them instead.
 
You can create a query to duplicate the numbers and multiply them by -1
 
Cool sounds like a plan.. Link the check box to the query to do the conversion? Sorry my Access skills are a little weak :)
 
Not understanding the format property, but Ive just read a little on it. I could use the format property to convert the selected number to a negative by doing some calculations. The problem being the calculation would be different on each selection? Or am I miss understanding?

Thanks
 
Im getting there, Ive got my query to work!! I know it sounds so simple to you guys but its quite an achievement for me :)

Next thing - now I have my 2 lists. Is it possible to switch between the 2 lists based on a tick box value?
 
So if you look at the property sheet for your textbox, you will see the Format property. Type -# and open your form to see the result.

If you're going to use a checkbox to turn it off and on, just set the Format property to "" to turn off, and -# to turn back on.
 
Ah ok, but it doesn't seem to like decimal numbers, is there any reason for this? Also when you say about the check box, to turn on and off. How does this work? I can only see the option for 1 entry within the format property of the combo box list. Thanks
 
Add a Button to the Form

Insert the following Code in the "On Click" event

Me.Numberfield = -(Me.Numberfield)
DoCmd.RunCommand acCmdSaveRecord

This will do the inverse as well should you need to undo the "negativizing" of the number.
 
Sooooo many ways to skin a cat. I actually got it working just before you posted this solution, but I prefer your solution so thats the one Im going with - thanks.

:)
 
Sooooo many ways to skin a cat. I actually got it working just before you posted this solution, but I prefer your solution so thats the one Im going with - thanks.

:)
Is this supposed to be a permanent change to that value or just whilst the user is working with that record?
 
Just why the user is working on that record. Im rubbish at putting what I actually want into words - maybe over time I'll get better :)
 
And then what should happen after the user moves to another record? Should it save the minus or not?
 
As it stands its working as I wanted. After its submitted the minus goes away unless they want to re-add it. Works like a charm :)
 

Users who are viewing this thread

Back
Top Bottom