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, 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.






  #8  
Old June 28th, 2007, 07:12 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?

going to be calculating board feet, the formula is WxL \ 144 (11 7/8 x 12 7/8
Divided by 144 and the rusult will be shown in a seprit text box . I can send
you the DB if that will help.

"Steve" wrote:

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.






  #9  
Old June 28th, 2007, 09:29 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 11:12:03 -0700, KevinKBM
wrote:

going to be calculating board feet, the formula is WxL \ 144 (11 7/8 x 12 7/8
Divided by 144 and the rusult will be shown in a seprit text box . I can send
you the DB if that will help.


Ok... let's see if I can throw something together.

Assuming you have Text fields [Length] and [Width] containing strings like
"11 7/8" or "4 15/16" try creating a function in a public module:

Public Function FracToNum(strDim As String) As Double
Dim strFrac As String
Dim strNum As String
Dim dblNumerator As Double
Dim dblDenominator As Double
On Error GoTo Proc_Error
If InStr(strDim, " ") 0 Then ' both number and fraction
strNum = Left(strDim, InStr(strDim, " ") - 1)
strFrac = Mid(strDim, InStr(strDim, " ") + 1)
Else ' only one piece: is it a number or a fraction?
If InStr(strDim, "/") 0 Then ' just a fraction
strFrac = strDim
strNum = "0"
Else
strFrac = "0/1"
strNum = strDim
End If
End If
dblNumerator = CDbl(Left(strFrac, InStr(strFrac, "/") - 1))
dblDenominator = CDbl(Mid(strFrac, InStr(strFrac, "/") + 1))
FracToNum = CDbl(strNum) + dblNumerator/dblDenominator
Proc_Exit:
Exit Function
Proc_Error:
MsgBox "Error " & Err.Num & " in FracToNum:" & vbCrLf & Err.Description
Resume Proc_Exit
End Function



and as a bonus, found this in my module:



Public Function DecimalToFrac(DecimalIn) As String

'Convert decimal to Fraction

Dim strWholePart As String
Dim varNumerator As Variant
Dim lngDenominator As Long
Dim intX As Integer
strWholePart = Int(DecimalIn)
intX = InStr([DecimalIn], ".")

If intX = 0 Or IsError(Mid([DecimalIn], intX + 1)) Then
DecimalToFrac = strWholePart
Exit Function
End If

varNumerator = Mid(DecimalIn, InStr(DecimalIn, ".") + 1)
lngDenominator = 1 & String(1 * Len(varNumerator), "0")

Do While lngDenominator Mod 5 = 0 And varNumerator Mod 5 = 0
varNumerator = varNumerator / 5
lngDenominator = lngDenominator / 5
Loop

Do While lngDenominator Mod 2 = 0 And varNumerator Mod 2 = 0
varNumerator = varNumerator / 2
lngDenominator = lngDenominator / 2
Loop

DecimalToFrac = strWholePart & " " & varNumerator & "/" & lngDenominator

End Function

John W. Vinson [MVP]
  #10  
Old June 30th, 2007, 02:59 PM posted to microsoft.public.access.forms
jrmask via AccessMonster.com
external usenet poster
 
Posts: 8
Default how do i set access to use fractions and add/multiply them?

I do this for corrugated sheets to fiqure board feet. I use fractions for the
calculations and taught my people to use them by suppling a conversion sheet.
Now they enter 1.75 for 1 3/4 inches or 5.625 for 5 5/8. Most do not have to
look at the conversion chart any longer. =([txtLenght] * [txtwidth]) /144



KevinKBM wrote:
going to be calculating board feet, the formula is WxL \ 144 (11 7/8 x 12 7/8
Divided by 144 and the rusult will be shown in a seprit text box . I can send
you the DB if that will help.

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",

[quoted text clipped - 74 lines]
ba
able to add, multiply and divide them.


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

 




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 08:42 PM.


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