I have the following code in a MODULE.
' Open a connection.
Set myconn = New ADODB.connection
myconn.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & DB_Path_File_param & ";" & _
"Persist Security Info=False"
myconn.Open
myconn.CursorLocation = adUseClient
'-------------------------------------------------------------
ListFields(myconn, tbl_or_qry_selected_item)
It works fine.
I then attempted to make the 'open connection' code
into a CLASS, like this:
'--------------------------------------------------------
Public Function Open_ADO_conn_to_Jet(Path_Filename As String) As Object
Dim connection As ADODB.connection
' Open a connection.
Set connection = New ADODB.connection
connection.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Path_Filename & ";" & _
"Persist Security Info=False"
connection.Open
connection.CursorLocation = adUseClient
Open_ADO_conn_to_Jet = connection
End Function
'-----------------------------------------------------------------
and THEN call the function with this
Set DB_Hookup_dbf = New DB_Class_dbf
Set myconn = DB_Hookup_dbf.Open_ADO_conn_to_Jet (DB_Path_File_param)
The DB_Path_File_param passed is okay.
BUT this results in a 424 Runtime error, of OBJECT REQUIRED. I am somewhat miffed
by just what I have done incorrectly here. Where am I missing an object here?
eatc7402
DaveF.