From: nt_consulting64@yahoo.com   
      
   "JP" wrote in message   
   news:hZK1h.5395$dx4.5294@trndny05...   
   > 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   
   >   
      
   The problem is with your connection string. Perhaps it is opening the   
   database with 'exclusive' rights or some other restriction?   
      
   Try creating one adodb.connection object and assigning that as the   
   DataSource for each of your Adodcs.   
      
   -ralph   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|