Operation is not allowed when object is opened.
Hello there !
I've a problem with opening the connection..
It's working properly if I use Set Keyword in Highlighted line....
But if I don't use it I am getting an error like..
Operation is not allowed when object is opened.
I'm not getting it why is it happening while I didn't open any connection before..
My code is:
Private Sub Form_Load()
Dim con As New ADODB.Connection
con = con_open(con, "D:\DBName.mdb") 'here I'm getting error.
But if I do like this
set con = con_open(con, "D:\DBName.mdb") 'It is working properly.
end sub
Public Function con_open(con1 As ADODB.Connection, path As String) As ADODB.Connection
con1.Provider = "Microsoft.jet.oledb.4.0"
con1.ConnectionString = path
con1.Open
Set con_open = con1
End Function
Could someone help me?
DPK..
__________________
DPK..
|