Help in Creating a module for connection string in my sql

Submitted by MOJOMOJI on
i have a code here but it keep on getting errors i have this connection in a module Public Sub dbconnect() Set conn = New ADODB.Connection conn.ConnectionString = "Driver={MySQL ODBC 5.1 Driver};Server=localhost; Database=text_dbs; Port=3306; User=root;Password=1234;Option=3;" conn.Open End Sub '--------------------------------------------------------------------------------------------------------------------- Private Sub Form_Load() call dbconnect End Sub this wont run.. what seems to be the problem?... but if i put it like this Private Sub Form_Load() Set conn = New ADODB.Connection conn.ConnectionString = "Driver={MySQL ODBC 5.1 Driver};Server=localhost; Database=text_dbs; Port=3306; User=root;Password=1234;Option=3;" conn.Open End Sub it will run..the problem is i got a lot of forms that uses this connection...i want to put it in a module.... anyone can show me how to do it correctly...thanks in advance...