Link to home
Start Free TrialLog in
Avatar of Sandra Smith
Sandra SmithFlag for United States of America

asked on

Get decimal part of a number, but store as integer ACCESS 2003 Database

I have a request for a change in recording time from just minutes to minuts and seconds.  The data will be stored in the main table as, say 1.30 minutes, that is one minute and thirty seconds.  On the form, there are two fields, one for minutes and one for seconds.  However, if there is a value in the field already, on the form I want the minute to appear, obviously, in the minute box and the seconds in the seconds box.  I amusing INT to get the interger, but I need to figure out how to get the decimals from the permanent table into the temp table as integer to be stored until they are returned to the permanent table.  that is, 1.30 needs to be in two boxes and if the user updates teh seconds to say 45, then what will be returned to the permanent table is the value 1.45 (on the seconds table, the max value accepted is 59 so keeps the user from inputting what would be considered a minute number)
Avatar of ajb2222
ajb2222

convert the number to a string
split the string at the decimal point

if this is a macro

      sTempString= Format(str(1.3), "#0.00")
      sseconds =  Right(sTempString, Len(sTempString) - InStr(sTempString, "."))

ASKER CERTIFIED SOLUTION
Avatar of awking00
awking00
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Sandra Smith

ASKER

Thank you both.  However, I was trying to remember the mod function as I knew there was something that did this.