home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.visual.basic      MS Visual Basic discussions, NOT dot-net      10,840 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 10,281 of 10,840   
   JP to Geoff   
   Re: ADO Data Control in VB 6.0   
   31 Oct 06 16:37:33   
   
   From: jprobb@seniortrans.com   
      
   Geoff...   
      
   The help file shows that the ADO Recordsource can be an SQL Statement.   
   That's what I've tried to execute.  In the example I gave... I ran a DAO   
   recordset to see if the SQL was correct.  It was.  The actual code is:   
      
   Private Sub GetPositions(lgDeptID As Long, lgLocID As Long)   
       Dim sPositSQL As String   
      
       sPositSQL = "SELECT [Position Table].LocationID, [Position   
   Table].DepartID, "   
       sPositSQL = sPositSQL & "[Position Table].Position "   
       sPositSQL = sPositSQL & "From [Position Table] "   
       sPositSQL = sPositSQL & "Where ((([Position Table].LocationID) = " &   
   lgLocID & ") And "   
       sPositSQL = sPositSQL & "(([Position Table].DepartID) = " & lgDeptID &   
   ")) "   
       sPositSQL = sPositSQL & "ORDER BY [Position Table].Position; "   
      
       With datPosit   
           .ConnectionString = stConn   
           .RecordSource = sPositSQL   
           .Refresh   
       End With   
      
   End Sub   
      
   As you can see, there is no DAO here.  I'm just trying to put the   
   "recordsource" (SQL) as the recordset to be used in the control.   
      
   I need a grid and am using the DataGrid which requires the ADODC.  On my   
   tool bar, when I run my mouse over the other data control, it says "Data"   
   and that will not display as an appropriate datasource for the DataGrid.   
      
   I'm not using DAO for any ADODC control on any form... I'm using SQL   
   Statements as the Recordsource.   
      
   JP   
      
      
   "Geoff"  wrote in message   
   news:45468aef$0$2442$db0fefd9@news.zen.co.uk...   
   >   
   > "JP"  wrote in message   
   > news:Ndo1h.2192$B44.827@trndny07...   
   >> Yes, I'm referring to the correct control... It is on a form...and called   
   >> datPOS.  The other control on the other form is "datDep"... so I am   
   >> referring to the correct control   
   >>   
   > Well the ADO data control is designed to work with ADO, not DAO.   
   > Are you sure both forms are using tha ADO control with DAO.   
   > When you hover your mouse over the toolbar .   
   > The DAO dataControl displays DATA1, the ADO displays ADODC.   
   > I suggest you start by using the DATA1 control with DAO.   
   > or ditch the DAO.Recordsets & use ADO.Recordsets with   
   > the ADO Control   
   > Regards G.   
   >   
   >   
   >   
   >   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca