2) Set DB = CurrentDb
If you are using a variable with global scope then that may
be important. Common MS examples always do that, so
that the example can be used generally, particularly in ASP.
But in VBA, Set DB = Nothing is implicit in End Sub or
Exit Sub.
In Access, if the next line is End Sub (or Exit Sub, or other
code, then End/Exit sub), then your line 4 is not required.
2) Set DB = CurrentDb
3) DB.Close
Line 2 does not add a new database to the databases
collection. If it did, you would want to close the new
database object, which you could do by using Close,
or by setting all of the references to Nothing, or by letting
all of the references go out of scope.
If you use OpenDatabase with ASP, you would want
to close the database and set the reference to nothing.
If you want to write an OpenDatabase example for
general use, you would want to close the database and
set the reference to nothing.
But if you are using Access VBA subroutines with
CurrentDB, those two lines just make your code longer.
(david)