Help on using Shape

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Peter (anonymous_at_discussions.microsoft.com)
Date: 06/04/04

  • Next message: Bent Lund: "VB6 Stored Procedure Wizard"
    Date: Fri, 4 Jun 2004 00:41:06 -0700
    
    

    I used the vbDataform Wizard to create a Master detail from. The form desplays fine, however, im trying to refine it slightly. This form is part of a project that already has a 'trusted connection ' to a SQL server, and rather that make a new connection ech time this form is used, i'd like to use the current connection. Ive managed it fine with all my other forms, its only the ones using the Hsape command that seem to cause the problem. The Global connection to the SQL Server is calle 'Userdbconnect' current code for the master detail form ;

    Private Sub Form_Load()
      Dim db As Connection
      Set db = New Connection
      db.CursorLocation = adUseClient
      db.Open "PROVIDER=MSDataShape;Data PROVIDER=MSDASQL;dsn=" & pParmString(0) & ";uid=" & pParmString(2) & ";pwd=" & pParmString(3) & ";database=BossData;"
      Set adoPrimaryRS = New Recordset

      adoPrimaryRS.Open "SHAPE {select tblOA_Licence ,tblOA_AccountID,tblOA_BACSID,tblOA_SortCode,tblOA_AccountNumber,tblOA_AccountName,tblOA_Country from OriginatingAccounts Where tblOA_Licence = '" & pOrigLicence & "' Order by tblOA_Licence} AS ParentCMD APPEND ({select tblOA_Licence,tblOA_AccountID,tblOA_BACSID,tblOA_SortCode,tblOA_AccountNumber,tblOA_AccountName,tblOA_Country from OriginatingAccounts Order by tblOA_Licence } AS ChildCMD RELATE tblOA_Licence TO tblOA_Licence) AS ChildCMD", db, adOpenStatic, adLockOptimistic

    When i change the adoPrimaryRS.open line to use UserdbConnect instead of db i get the following error ;
    Runtime Error '-2147217900'
    Syntax error or access violation

    Can any one help ?


  • Next message: Bent Lund: "VB6 Stored Procedure Wizard"

    Relevant Pages

    • Re: DataSource class help
      ... MSDN article called "How To Extract Child Recordsets from Shaped ... Recordset" - Q191744, which is along the lines of what I am trying to do. ... > 1) Don't open an ADO Connection in the Class_Initialize event. ... > Set adoPrimaryRS = New ADODB.Recordset, ...
      (microsoft.public.vb.general.discussion)
    • Re: SQL Server Connection
      ... > set the ActiveConnection to Nothing and closed the database that there ... > be no active connections for my application in my SQL Server Database ... > Set adoPrimaryRS = New Recordset ... why is there still a connection to my database. ...
      (microsoft.public.vb.general.discussion)
    • Re: Authentication failed
      ... > Set adoPrimaryRS = New ADODB.Recordset ... Private Sub Form_Load ... Dim db As Connection ... Dim strDBPath As String ...
      (microsoft.public.vb.database)
    • Re: Problem with FIND command and 2000 machine
      ... Set db = New Connection ... db.CursorLocation = adUseClient ... Set adoPrimaryRS = New Recordset ...
      (microsoft.public.vb.general.discussion)
    • Re: Application Role - aduseclient
      ... The only thing I can think of is if the recordset is opening ... It happens in ADO sometimes where a connection is ... >Set bestelcon = New Connection ... >As long as there is no "aduseclient or aduseclientbatch", ...
      (microsoft.public.sqlserver.security)