A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

how do i set access to use fractions and add/multiply them?



 
 
Thread Tools Display Modes
  #1  
Old June 27th, 2007, 07:42 PM posted to microsoft.public.access.forms
KevinKBM
external usenet poster
 
Posts: 14
Default how do i set access to use fractions and add/multiply them?

I need to use fractions in a Access Form to calculate sq foot and other board
dimentions. can't find anything in the help file or settings. I need to ba
able to add, multiply and divide them.
  #2  
Old June 27th, 2007, 07:56 PM posted to microsoft.public.access.forms
Douglas J. Steele
external usenet poster
 
Posts: 9,313
Default how do i set access to use fractions and add/multiply them?

There's no way built into Access.

I suppose it might be possible to create functions that look at the
character value of the fractions (for example, ¼ has an Ascii value of 188,
½ has a value of 189 and ¾ has a value of 190) and translates them to the
appropriate value, but that's very limited.

How were you intended to get the fractions into Access?

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"KevinKBM" wrote in message
news
I need to use fractions in a Access Form to calculate sq foot and other
board
dimentions. can't find anything in the help file or settings. I need to ba
able to add, multiply and divide them.



  #3  
Old June 27th, 2007, 08:22 PM posted to microsoft.public.access.forms
KevinKBM
external usenet poster
 
Posts: 14
Default how do i set access to use fractions and add/multiply them?

It's for a order form for doors my company produces. all measurments are in
inches. if i knew more about VBA i'm certin a bit of code could solve this
issue but programming in VBA escapes me and this is due end of week.

Thanks for your reply

"Douglas J. Steele" wrote:

There's no way built into Access.

I suppose it might be possible to create functions that look at the
character value of the fractions (for example, ¼ has an Ascii value of 188,
½ has a value of 189 and ¾ has a value of 190) and translates them to the
appropriate value, but that's very limited.

How were you intended to get the fractions into Access?

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"KevinKBM" wrote in message
news
I need to use fractions in a Access Form to calculate sq foot and other
board
dimentions. can't find anything in the help file or settings. I need to ba
able to add, multiply and divide them.




  #4  
Old June 27th, 2007, 09:22 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default how do i set access to use fractions and add/multiply them?

Here is something I found on the internet by googling "convert decimal to
fraction in VB"
I played with it and it is okay for even things .125 returns 1/18, etc, but
for 1/3 I tried .67, .667, etc. and got useless results. I tried doing 1/3
in VBA and passing it the number results from that and it went away. I got
tired of waiting and canceled it.
--
Dave Hargis, Microsoft Access MVP


"KevinKBM" wrote:

It's for a order form for doors my company produces. all measurments are in
inches. if i knew more about VBA i'm certin a bit of code could solve this
issue but programming in VBA escapes me and this is due end of week.

Thanks for your reply

"Douglas J. Steele" wrote:

There's no way built into Access.

I suppose it might be possible to create functions that look at the
character value of the fractions (for example, ¼ has an Ascii value of 188,
½ has a value of 189 and ¾ has a value of 190) and translates them to the
appropriate value, but that's very limited.

How were you intended to get the fractions into Access?

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"KevinKBM" wrote in message
news
I need to use fractions in a Access Form to calculate sq foot and other
board
dimentions. can't find anything in the help file or settings. I need to ba
able to add, multiply and divide them.




  #5  
Old June 28th, 2007, 02:13 AM posted to microsoft.public.access.forms
Steve[_10_]
external usenet poster
 
Posts: 608
Default how do i set access to use fractions and add/multiply them?

TblFractionPart
FractionPartID
FractionPart
DecimalOfFractionPart

TblFractionMeasurement
FractionMeasurementID
FractionPartID
FractionMeasurement

TblFractionPart would contain:
1, "/2",.5
2, "/4", .25
3, "/8", .125
4, "/16", .1667

TblFractionMeasurement would contain:
1, 1, 1
2, 2, 1
3, 2, 2
4, 2, 3
5, 3, 1
6, 3, 2
7, 3, 3
8, 3, 4
9, 3, 5
etc to --
26, 4, 15

On your form where you need to enter a dimension, you need a textbox named
wholeinches for entering the whole inches, a combobox named fractionpart
for picking the fraction part, a combobox named fractionmeasurement for
picking the numerator of the fraction, i.e. 15 for 15/16", a textbox named
MyMeasurement to display the measurement and a hidden textbox named
myMeasurementValue to contain the value of the measurement. Note combobox,
fraction part, needs to be based on TblFractionpart and contain all the
fields. I have left it to you to set up the comboboxes.

You then need to put the following in the control source of MyMeasurement:
=[WholeInches] & " " & [FractionMeasurement].Column(2) &
[FractionPart].Column(1)

You then need to put the following in the control source of
MyMeasurementValue:
= [WholeInches] + [FractionMeasurement].Column(2) *
[FractionPart].Column(2)

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications




"KevinKBM" wrote in message
news
I need to use fractions in a Access Form to calculate sq foot and other
board
dimentions. can't find anything in the help file or settings. I need to ba
able to add, multiply and divide them.



  #6  
Old June 28th, 2007, 01:28 PM posted to microsoft.public.access.forms
KevinKBM
external usenet poster
 
Posts: 14
Default how do i set access to use fractions and add/multiply them?

Thanks Steve this will realy help a lot.
Is there a way to set this as a query? i'm going to have to have about 25
lines on the form and to do this that many times will be a ton of typing. so
if there is a wayto do it as multiple rows if not then no problem. and thanks
again for the help

"Steve" wrote:

TblFractionPart
FractionPartID
FractionPart
DecimalOfFractionPart

TblFractionMeasurement
FractionMeasurementID
FractionPartID
FractionMeasurement

TblFractionPart would contain:
1, "/2",.5
2, "/4", .25
3, "/8", .125
4, "/16", .1667

TblFractionMeasurement would contain:
1, 1, 1
2, 2, 1
3, 2, 2
4, 2, 3
5, 3, 1
6, 3, 2
7, 3, 3
8, 3, 4
9, 3, 5
etc to --
26, 4, 15

On your form where you need to enter a dimension, you need a textbox named
wholeinches for entering the whole inches, a combobox named fractionpart
for picking the fraction part, a combobox named fractionmeasurement for
picking the numerator of the fraction, i.e. 15 for 15/16", a textbox named
MyMeasurement to display the measurement and a hidden textbox named
myMeasurementValue to contain the value of the measurement. Note combobox,
fraction part, needs to be based on TblFractionpart and contain all the
fields. I have left it to you to set up the comboboxes.

You then need to put the following in the control source of MyMeasurement:
=[WholeInches] & " " & [FractionMeasurement].Column(2) &
[FractionPart].Column(1)

You then need to put the following in the control source of
MyMeasurementValue:
= [WholeInches] + [FractionMeasurement].Column(2) *
[FractionPart].Column(2)

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications




"KevinKBM" wrote in message
news
I need to use fractions in a Access Form to calculate sq foot and other
board
dimentions. can't find anything in the help file or settings. I need to ba
able to add, multiply and divide them.




  #7  
Old June 28th, 2007, 02:18 PM posted to microsoft.public.access.forms
jahoobob via AccessMonster.com
external usenet poster
 
Posts: 228
Default how do i set access to use fractions and add/multiply them?

Try this in the Lost Focus or AfterUpdate property of the textbox (Text0)
where the fraction is entered:
slash = InStr(Me.Text0, "/")
Me.Text3 = Left(Me.Text0, slash - 1) / Right(Me.Text0, Len(Me.Text0) - slash)
You can change Me.Text3 to a variable or a field in a table if you want to
store it

KevinKBM wrote:
I need to use fractions in a Access Form to calculate sq foot and other board
dimentions. can't find anything in the help file or settings. I need to ba
able to add, multiply and divide them.


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200706/1

  #8  
Old June 28th, 2007, 02:19 PM posted to microsoft.public.access.forms
jahoobob via AccessMonster.com
external usenet poster
 
Posts: 228
Default how do i set access to use fractions and add/multiply them?

BTW, the above converts ANY fraction to a decimal.

jahoobob wrote:
Try this in the Lost Focus or AfterUpdate property of the textbox (Text0)
where the fraction is entered:
slash = InStr(Me.Text0, "/")
Me.Text3 = Left(Me.Text0, slash - 1) / Right(Me.Text0, Len(Me.Text0) - slash)
You can change Me.Text3 to a variable or a field in a table if you want to
store it

I need to use fractions in a Access Form to calculate sq foot and other board
dimentions. can't find anything in the help file or settings. I need to ba
able to add, multiply and divide them.


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200706/1

  #9  
Old June 28th, 2007, 03:39 PM posted to microsoft.public.access.forms
Steve[_10_]
external usenet poster
 
Posts: 608
Default how do i set access to use fractions and add/multiply them?

Show me how you are going to apply a measurement that includes fractions and
maybe I can help you from there. For example, your measurement is 125 5/8",
what are you going to do with it.

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications





"KevinKBM" wrote in message
...
Thanks Steve this will realy help a lot.
Is there a way to set this as a query? i'm going to have to have about 25
lines on the form and to do this that many times will be a ton of typing.
so
if there is a wayto do it as multiple rows if not then no problem. and
thanks
again for the help

"Steve" wrote:

TblFractionPart
FractionPartID
FractionPart
DecimalOfFractionPart

TblFractionMeasurement
FractionMeasurementID
FractionPartID
FractionMeasurement

TblFractionPart would contain:
1, "/2",.5
2, "/4", .25
3, "/8", .125
4, "/16", .1667

TblFractionMeasurement would contain:
1, 1, 1
2, 2, 1
3, 2, 2
4, 2, 3
5, 3, 1
6, 3, 2
7, 3, 3
8, 3, 4
9, 3, 5
etc to --
26, 4, 15

On your form where you need to enter a dimension, you need a textbox
named
wholeinches for entering the whole inches, a combobox named fractionpart
for picking the fraction part, a combobox named fractionmeasurement for
picking the numerator of the fraction, i.e. 15 for 15/16", a textbox
named
MyMeasurement to display the measurement and a hidden textbox named
myMeasurementValue to contain the value of the measurement. Note
combobox,
fraction part, needs to be based on TblFractionpart and contain all the
fields. I have left it to you to set up the comboboxes.

You then need to put the following in the control source of
MyMeasurement:
=[WholeInches] & " " & [FractionMeasurement].Column(2) &
[FractionPart].Column(1)

You then need to put the following in the control source of
MyMeasurementValue:
= [WholeInches] + [FractionMeasurement].Column(2) *
[FractionPart].Column(2)

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications




"KevinKBM" wrote in message
news
I need to use fractions in a Access Form to calculate sq foot and other
board
dimentions. can't find anything in the help file or settings. I need to
ba
able to add, multiply and divide them.






  #10  
Old June 28th, 2007, 06:39 PM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default how do i set access to use fractions and add/multiply them?

On Thu, 28 Jun 2007 13:19:11 GMT, "jahoobob via AccessMonster.com"
u12179@uwe wrote:

BTW, the above converts ANY fraction to a decimal.


but won't work with the very common syntax "8 3/4" - it will convert a pure
fraction OK, but if it's got a prior integer number you'll need to extract
just the fraction.

John W. Vinson [MVP]
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:24 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.