View Single Post
  #29  
Old July 9th, 2007, 07:09 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 Mon, 9 Jul 2007 09:48:04 -0700, KevinKBM
wrote:

ok the fields where fractions will be used are named "width## and Height##"
where ## are numbered 01 to 41.


Then your table design IS WRONG.

"Fields are expensive, records are cheap". If you have 41 sets of dimensions,
you'll someday have 42. You should have the data stored in a second table,
with one set of dimensions per record, rather then per field.

It may be that you're starting your database design with the form (perhaps
imitating a paper form?); if so, that's the wrong end about. You wouldn't
start building a house frame before you've poured the foundations - and a
properly normalized set of Tables is the foundation of your database! The
forms come later.

there will be several lines on the order
form where this will be done. the error i get is telling me the number i
enter is to large for the field (5 7/8) the error reads "The Value you
entered isn't valid for this field" "For example, you may have entered text
in a numeric field or a number that is larger then the Field Size setting
permits."


I placed your code in a public module and named it "fractonum"


Change the name of the module. It must have a name *DIFFERENT* from the name
of the function. I'd just call it basFracToNum.

You need TWO TEXTBOXES - one, probably unbound, let's call it txtWidth; and
the other bound to a Number field in your table, let's call it txtNumWidth.
Put the following code in the AfterUpdate event of txtWidth:

Private Sub txtWidth_AfterUpdate()
Me!txtNumWidth = FracToNum(Me!txtWidth)
End Sub

Or, if you want to *store* the 12 15/16 text string in your table, change the
datatype of the Width field (or fields, if you really insist on using a VERY
BADLY FLAWED design) from Number to Text; you can *display* the decimal size
by setting the control source of a textbox (unbound) to

=FracToNum([txtWidth])

However, I'd stick with the number field in your table - one width and one
height per record NOT 41 of them! You're using a relational database, not a
spreadsheet!

John W. Vinson [MVP]