June 5, 200421 yr I'm creating a cookbook DB for my wife. Easy enough. I told her that any fractional quantities will have to be entered as a decimal number. She didn't like that idea, saying that it's easier and less confusing to enter and see "3/4" rather than .75 Ok, easy enough - or so I thought. I would prefer to have the quantity as an indexable numberic value, so that if I want to double the recipe (for example), the calculations will be easy to deal with, and for other programming reasons. I tried to change the quantity as a text field, and use the texttonum & numtotext in any calculations. That pesky "/" was getting in the way, though. I didn't want to separate out a field for the numerator and another field for the denominator, because not all quantities are going to be fractional. I suppose that there are a few different ways to tackle this problem (as with any programming problem). I suppose I could figure this out eventually on my own. But I figure it's much easier asking everyone here and having an immediate result, rather than keep banging my head against the wall. I've done enough of that at work, and I'm sure not going to continue at home! Plus I'm sure I'm not the only person out there that has tried this already. Any ideas will be greatly appreciated. -Brent
June 5, 200421 yr Hi Brent, Here are a couple of files that show how to do this. Fractions to Decimals By: John Mark Osborne URL: http://www.databasepros.com Number to Fraction By: John Mark Osborne URL: http://www.fmfiles.com/tnt1.html HTH Lee
June 11, 200421 yr Author Oh yea Detlev Sometimes I like to complicate things WAY too much. That will be perfect - as long as the numberator and/or the denominator is only one number long (ex. 1/8) It would be easy enough to make a case statement to determine how many characters are before/after the slash to make other arrangements for the left/right functions. To anyone reading this - recipies normally won't have measurements smaller that X/8. So for all practical purposes, what Detlev has come up with will be great for what I'm doing. I won't need to worry about the 16th measurements. Now it's on to figuring out how to convert these number to metric.... Thanks Detlev and Lee!
Create an account or sign in to comment