About the pre-connect event, check out ON LOGON in the help file.