travisbrown
Technical User
- Dec 31, 2001
- 1,016
If you call a function within a function, are variables kept within scope, or can they conflict with the inner function if named the same? In this case, should the closing of the inner RS inadvertently close the outer RS? I mean, it seems to be doing this, but just making sure that it should do this. I thought variables would be kept in scope only.
Code:
FUNCTION TimeOff(id, StartDate, EndDate)
sSQL = "Select..."
Set rs = Server.CreateObject("ADODB.Recordset")
rs.ActiveConnection = connSTRING
rs.Source = sSQL
rs.Open()
IF NOT rs.EOF OR NOT rs.BOF THEN
TimeOff = "A Value" & TimeOffDates(id, StartDate)
END IF
rs.Close()
Set rs = Nothing
END FUNCTION
FUNCTION TimeOffDates(ContactID, StartDate)
sSQL = "SELECT ..."
Set rs = Server.CreateObject("ADODB.Recordset")
rs.ActiveConnection = connSTRING
rs.Source = sSQL
rs.Open()
IF NOT rs.EOF OR NOT rs.BOF THEN
TimeOffDates = "Another value"
END IF
rs.Close()
Set rs = Nothing
END FUNCTION