It isn't in scope I'm afraid, it is currently limited to the sub Search_Click. To fix this, move the declaration line to General Declarations (the same place as the declaration of oConn etc.), and move the following two lines from Search_Click to Form_Unload:
You should also add these lines to Form_Unload (after the two lines above):VB Code:
rst.Close Set rst = Nothing
VB Code:
oConn.Close Set oConn = Nothing
You should probably also remove the following section from AddUser, as it closes the recordset after adding a new record.
VB Code:
If rst.State <> adStateClosed Then On Error Resume Next rst.Close End If




Reply With Quote