[AccessD] Converting Imperial measures

John Bodin jbodin at sbor.com
Fri Feb 16 09:49:41 CST 2018


Maybe in the next 1 5/32 years...




Nice function btw.



John Bodin

sBOR Office Systems

jbodin at sbor.com<mailto:jbodin at sbor.com>




________________________________
From: AccessD <accessd-bounces at databaseadvisors.com> on behalf of Gustav Brock <gustav at cactus.dk>
Sent: Friday, February 16, 2018 10:37 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Converting Imperial measures

Hi all

One more Replace is needed to accept strings with a dash like 8' 5-7/16":

DecimalFeet =
  Eval(Replace(Replace(Replace(Replace(m, """", ""), "'", "*12 "), " ", "+"), "-", "+")) / 12

When DO the US enter modern time and switch to decimals?

/gustav

-----Oprindelig meddelelse-----
Fra: AccessD [mailto:accessd-bounces at databaseadvisors.com] På vegne af Gustav Brock
Sendt: 16. februar 2018 15:59
Til: Access Developers discussion and problem solving <accessd at databaseadvisors.com>
Emne: [AccessD] Converting Imperial measures

Hi all

Good examples for usage of Eval are rare, but here is one - a one-liner for converting Imperial feet-inch measures (string) to decimal feet (double):

DecimalFeet = Eval(Replace(Replace(Replace([Measurement], """", ""), "'", "*12 "), " ", "+")) / 12

It will accept expressions like:

6'
7"
7 3/4"
6'7"
6' 7"
6'  5 3/16"

/gustav

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


More information about the AccessD mailing list