Return two dates from one value (1 Viewer)

majhl

Registered User.
Local time
Today, 01:54
Joined
Mar 4, 2008
Messages
89
Hello,

I'm trying to write a function that will accept an input parameter - Q1, Q2, Q3 or Q4 - and return two dates, a start and end date based on the value of the input parameter. So if the input was Q1, the start date would be '01/01/2013' and the end date '31/03/2013'.

I can return one date OK, but how to return the second? A 'case' statement maybe? Thanks for any help.
 
Last edited:

Brianwarnock

Retired
Local time
Today, 09:54
Joined
Jun 2, 2003
Messages
12,701
A function containing a select case or a block If would do it

Brian
 

plog

Banishment Pending
Local time
Today, 03:54
Joined
May 11, 2011
Messages
11,669
Actually, the way you phrased it, I don't know if its possible. It's a pain if possible. You said you want 2 dates returned from the function, but functions generally only return one piece of data. I found this article on returning arrays from a function (http://msdn.microsoft.com/en-us/library/office/aa189081(v=office.10).aspx). Good luck.
 

majhl

Registered User.
Local time
Today, 01:54
Joined
Mar 4, 2008
Messages
89
Actually, the way you phrased it, I don't know if its possible. It's a pain if possible. You said you want 2 dates returned from the function, but functions generally only return one piece of data. I found this article on returning arrays from a function (http://msdn.microsoft.com/en-us/library/office/aa189081(v=office.10).aspx). Good luck.

I thought that two functions, one to return the start date and one the end date, might be the easiest way.

Thanks for the suggestions.
 

Brianwarnock

Retired
Local time
Today, 09:54
Joined
Jun 2, 2003
Messages
12,701
Yes 2 functions as you suggest is the easy simple way, sorry I missed that point.

I presume you are doing this in a query , not filling controls on a form where a sub could return both.

Brian
 

Users who are viewing this thread

Top Bottom