To use the ADODB.Connection object in the code, you can add the following line of code at the beginning of the code, after the declaration of the variables:
Dim adoconn As New ADODB.Conn
ection
This will create a new instance of the ADODB.Connection object, which can be used to establish a connection to a data source using ActiveX Data Objects (ADO). You can then use the Open method of the adoconn object to open a connection to the desired data source.
For example, to open a connection to a Microsoft SQL Server database, you can use the following code:
adoconn.Open "Provider=SQLOLEDB;Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;"
Once the connection is open, you can use the Execute method of the adoconn object to execute SQL queries or stored procedures on the data source.
However, it is worth noting that the code you provided does not appear to use a database or any other data source that would require a connection. Instead, it appears to be using the GetObject function to retrieve information about an Active Directory user, based on the user's signum. In that case, you do not need to use the ADODB.Connection object.
As for the issue with the idapstr line, it is difficult to say without more information. It is possible that there is a problem with the data being passed to the GetObject function, or with the way the ldapstr variable is constructed. I would recommend checking the values of the signum and other variables that are used to construct the ldapstr variable, to make sure they are correct and valid. You may also want to try using the Debug.Print statement to print the value of the ldapstr variable, to see if it is correct.