[AccessD] CurrentProject.Path syntax?

Heenan, Lambert Lambert.Heenan at chartisinsurance.com
Thu Mar 18 10:49:43 CDT 2010


Double deep sigh....

You know there used to be a contest in c-programmers land (might still be running) on who could put the greatest amount of functionality into a "one-liner" function. Lots of fun I'm sure, but still the code is obscure - hence the term write-only language, one where even the coder can't figure out what code does when returning to it after some time.

So iif() is a one liner, where If Then Else takes five. Back in the days of 48k RAM machines that difference was significant, but not any more.

Lambert

-----Original Message-----
From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Max Wanadoo
Sent: Thursday, March 18, 2010 10:56 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] CurrentProject.Path syntax?


Sigh...

   str = str & IIf(Right(str, 1) = "\", "", "\")

Easy peasy - one liner.

Max
 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Heenan, Lambert
Sent: Thursday, March 18, 2010 2:06 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] CurrentProject.Path syntax?

CRAB eh?

I maintain that this code 

Public Function QualifyPath(sPath As String) As String
    If sPath & "" > "" Then
        If right$(sPath, 1) = "\" Then
            QualifyPath = sPath
        Else
            QualifyPath = sPath & "\"
        End If
    End If
End Function 

Is thoroughly self documenting and orders of magnitude clearer than

    str = "\\svr\c\"
    strL = Left(str, 2)
    strR = Replace(Mid(str, 3) & "\", "\\", "\")
    str = strL & strR

In fact I'd go as far as to suggest that those few lines of VB code are almost as cryptic as some c/c++ code I have reviewed in the past. The C family has a well deserved reputation of being a write-only language. Well in the hands of some programmers. :-)


Lambert

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Max Wanadoo
Sent: Thursday, March 18, 2010 9:50 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] CurrentProject.Path syntax?

Are you saying:-

A. mine doesn't
B. mine is 20th century too.

Co'mon now. Don't beat about the bush...out with it...

Answers:
A. Mine does UNCs better than yours.  Stamps foot and sticks tongue out.  So there!
C. Mine adheres to the CRAB principle invented by yours truly (Clear, Relevant,  Accurate and Brief).

There we go...over and out....

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

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