Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Beginning VB 6
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 3rd, 2006, 04:24 AM
Friend of Wrox
 
Join Date: Jan 2006
Posts: 180
Thanks: 1
Thanked 1 Time in 1 Post
Send a message via ICQ to dpkbahuguna Send a message via MSN to dpkbahuguna Send a message via Yahoo to dpkbahuguna
Default 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..
 
Old April 3rd, 2006, 10:50 AM
Registered User
 
Join Date: Apr 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello Friend,
  In your coding you have already used NEW keyword so you need not use con = con_open(con, "D:\DBName.mdb").
Instead you just do following
con_open(con, "D:\DBName.mdb")
Try this and send me reply if it wont work.

bye bye

Regards
 
Old April 3rd, 2006, 10:53 PM
Friend of Wrox
 
Join Date: Jan 2006
Posts: 180
Thanks: 1
Thanked 1 Time in 1 Post
Send a message via ICQ to dpkbahuguna Send a message via MSN to dpkbahuguna Send a message via Yahoo to dpkbahuguna
Default

Hi Maxy !

   Thanks it worked nice....

   Thanks....

DPK..





Similar Threads
Thread Thread Starter Forum Replies Last Post
Operation is not allowed when the object is closed kingroon Classic ASP Databases 2 February 5th, 2008 10:29 AM
operation is not allowed when the object is opened naveed77 Beginning VB 6 4 August 2nd, 2006 09:09 PM
Operation is not allowed when the object is closed kah Javascript How-To 2 February 16th, 2005 07:20 AM
operation is not allowed when the object is close shoakat Classic ASP Databases 1 November 28th, 2004 06:16 AM
operation is not allowed when object is closed shoakat Classic ASP Databases 1 November 26th, 2004 12:17 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.