[AccessD] Need help with return in a function

Heenan, Lambert Lambert.Heenan at aig.com
Fri Apr 29 08:09:54 CDT 2016


Well recalled, Jim. It's all coming back to me now, CP/M and 8 inch floppy disks. :-)

Lambert



-----Original Message-----
From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Jim Dettman
Sent: Thursday, April 28, 2016 5:50 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Need help with return in a function


 Just to add in one comment, "Return" is a valid VBA statement, but in VBA it's used in conjunction with a Gosub within a procedure.

 Return <value> 

 in more modern languages does return a value from a procedure.  So VBA is a little confusing in this regard (it's a throwback to the original Dartmouth Basic).

Jim.

-----Original Message-----
From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Kaup, Chester
Sent: Thursday, April 28, 2016 01:56 PM
To: Access Developers discussion and problem solving
Subject: [AccessD] Need help with return in a function

Came across a bit of code in a database and I don't understand what one line is supposed to do or how it is intended to work. I get a syntax error of "Expected end of statement"  The line in question is return Len(Dir$(aFile))
>0. Thanks for the assistance.

Here is the whole function

Function Delete_File(aFile)
    Dim B As String
    On Error Resume
    Kill aFile
    On Error GoTo 0
    return Len(Dir$(aFile)) > 0         ' Make sure it actually got deleted.
End Function
--
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