Macro for rounding input in one field based on values in another f

A

Andy

Is it possible to build a macro that will round input values in a field based
on the value in another.

[PayItem]![Quantity] [Inventory]![ProductCost]

0.1 $0.1 to $9.99
0.01 $10.00 to $99.99
0.001 $100.00 to 1000.00
0.0001 $1001.00 to 10000.00
0.00001 $10001.00 to Infinity

[PayItem]![Quantity] is long intiger and [Inventory]![ProductCost] is Number
$ field.

Is this possible?
 
S

Steve Schapel

I am very sorry, Andy, but I'm afraid I can't make head nor tail of your
question.

By the way, Quantity can't be an integer, if you have decimals.

But anyway, can you please have another try to ask the question. Step by
step, what data is entered, and examples of what you want to happen.
Thanks.

--
Steve Schapel, Microsoft Access MVP


Andy said:
Is it possible to build a macro that will round input values in a field
based
on the value in another.

[PayItem]![Quantity] [Inventory]![ProductCost]

0.1 $0.1 to $9.99
0.01 $10.00 to $99.99
0.001 $100.00 to 1000.00
0.0001 $1001.00 to 10000.00
0.00001 $10001.00 to Infinity

[PayItem]![Quantity] is long intiger and [Inventory]![ProductCost] is
Number
$ field.

Is this possible?



__________ Information from ESET Smart Security, version of virus signature database 4136 (20090606) __________

The message was checked by ESET Smart Security.

http://www.eset.com
 
A

Andy

This is really a "significant digit question. I have a
field,[PayItemTransactions]![PayItemQuantity] and yes it is set to decimal,
in which, the user enters quantity used. The user must enter a pay item prior
to that from a table [PayItems]![Item] which also contains the field
[BidPrice]. Upon entering his or her data in the field
[PayItemTransactions]![PayItemQuantity], perhaps a macro "on dirty" can fire
and can set the perameter of the field [PayItemQuantity] to limit its
significant digits based on the [PayItems]![BidPrice].

The required field parameters are set as mentioned in the original question.

I think this is a tall order and Im not sure if it is even possible.
[BidPrice] is a varable but non changeable dollar value. It determines how
many significant digits must be entered for calculating precision of payment.
If the macro can automaticly set the number of digits prior to entering the
data into the field [PayItemQuantity] it would eliminate a massive number of
potential errors...The [PayItems] table can have a massive amount of items in
it.
--
Thanx A


Steve Schapel said:
I am very sorry, Andy, but I'm afraid I can't make head nor tail of your
question.

By the way, Quantity can't be an integer, if you have decimals.

But anyway, can you please have another try to ask the question. Step by
step, what data is entered, and examples of what you want to happen.
Thanks.

--
Steve Schapel, Microsoft Access MVP


Andy said:
Is it possible to build a macro that will round input values in a field
based
on the value in another.

[PayItem]![Quantity] [Inventory]![ProductCost]

0.1 $0.1 to $9.99
0.01 $10.00 to $99.99
0.001 $100.00 to 1000.00
0.0001 $1001.00 to 10000.00
0.00001 $10001.00 to Infinity

[PayItem]![Quantity] is long intiger and [Inventory]![ProductCost] is
Number
$ field.

Is this possible?



__________ Information from ESET Smart Security, version of virus signature database 4136 (20090606) __________

The message was checked by ESET Smart Security.

http://www.eset.com
 
S

Steve Schapel

Andy,

As far as I know, there is no way to limit the data entered into a field
according to significant digits.

However, on the Before Update event of the PayItemQuantity control, you
could test the value entered against the defined limits, and pop up a
message box to the user telling them if there's an error.

--
Steve Schapel, Microsoft Access MVP


Andy said:
This is really a "significant digit question. I have a
field,[PayItemTransactions]![PayItemQuantity] and yes it is set to
decimal,
in which, the user enters quantity used. The user must enter a pay item
prior
to that from a table [PayItems]![Item] which also contains the field
[BidPrice]. Upon entering his or her data in the field
[PayItemTransactions]![PayItemQuantity], perhaps a macro "on dirty" can
fire
and can set the perameter of the field [PayItemQuantity] to limit its
significant digits based on the [PayItems]![BidPrice].

The required field parameters are set as mentioned in the original
question.

I think this is a tall order and Im not sure if it is even possible.
[BidPrice] is a varable but non changeable dollar value. It determines how
many significant digits must be entered for calculating precision of
payment.
If the macro can automaticly set the number of digits prior to entering
the
data into the field [PayItemQuantity] it would eliminate a massive number
of
potential errors...The [PayItems] table can have a massive amount of items
in
it.



__________ Information from ESET Smart Security, version of virus signature database 4136 (20090606) __________

The message was checked by ESET Smart Security.

http://www.eset.com
 
A

Andy

That is almost what I thought. I did also think that in the
[PayItem]![ItemName] look up field i could also include (in its table entered
manually0 a field that includes [SignificantDigits] that will show up to
remind the user that the data in the [Quantity] requires x amonts of
precision.

Thanks for your help
--
Thanx A


Steve Schapel said:
Andy,

As far as I know, there is no way to limit the data entered into a field
according to significant digits.

However, on the Before Update event of the PayItemQuantity control, you
could test the value entered against the defined limits, and pop up a
message box to the user telling them if there's an error.

--
Steve Schapel, Microsoft Access MVP


Andy said:
This is really a "significant digit question. I have a
field,[PayItemTransactions]![PayItemQuantity] and yes it is set to
decimal,
in which, the user enters quantity used. The user must enter a pay item
prior
to that from a table [PayItems]![Item] which also contains the field
[BidPrice]. Upon entering his or her data in the field
[PayItemTransactions]![PayItemQuantity], perhaps a macro "on dirty" can
fire
and can set the perameter of the field [PayItemQuantity] to limit its
significant digits based on the [PayItems]![BidPrice].

The required field parameters are set as mentioned in the original
question.

I think this is a tall order and Im not sure if it is even possible.
[BidPrice] is a varable but non changeable dollar value. It determines how
many significant digits must be entered for calculating precision of
payment.
If the macro can automaticly set the number of digits prior to entering
the
data into the field [PayItemQuantity] it would eliminate a massive number
of
potential errors...The [PayItems] table can have a massive amount of items
in
it.



__________ Information from ESET Smart Security, version of virus signature database 4136 (20090606) __________

The message was checked by ESET Smart Security.

http://www.eset.com
 

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