G
Guest
Hi everyone,
Is there any difference between the following two ? If so, which one is
better, and why ? Does this make any sense ? Any suggestions are appreciated.
Method I Method II
----------------------------- -------------------------------
Dim db As DAO.Database Dim db As DAO.Database
Dim rs As DAO.Recordset Dim rs As DAO.Recordset
'Set Statements here 'Set Statements here
'Code here 'Code here
Set db = Nothing --> ExitHandle:
rs.Close Set db = Nothing
Set rs = Nothing rs.Close
ExitHandle: <-- Set rs = Nothing
Exit Sub Exit Sub
ErrHandle: ErrHandle:
'error handling here 'error handling here
Resume ExitHandle Resume ExitHandle
Is there any difference between the following two ? If so, which one is
better, and why ? Does this make any sense ? Any suggestions are appreciated.
Method I Method II
----------------------------- -------------------------------
Dim db As DAO.Database Dim db As DAO.Database
Dim rs As DAO.Recordset Dim rs As DAO.Recordset
'Set Statements here 'Set Statements here
'Code here 'Code here
Set db = Nothing --> ExitHandle:
rs.Close Set db = Nothing
Set rs = Nothing rs.Close
ExitHandle: <-- Set rs = Nothing
Exit Sub Exit Sub
ErrHandle: ErrHandle:
'error handling here 'error handling here
Resume ExitHandle Resume ExitHandle