<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: ACCESS vs. SQL Server - SQL statement... in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/access-vs-sql-server-sql-statement/m-p/334277#M88104</link>
    <description>Try replacing GROUP BY NAME with GROUP BY 1, which is a column number for&lt;BR /&gt;
the returned recordset.  And try adding a semi-colon at the end of the&lt;BR /&gt;
SELECT.&lt;BR /&gt;
--&lt;BR /&gt;
John Goodfellow&lt;BR /&gt;
irtf'nm&lt;BR /&gt;
use 'microtouch' in address to email&lt;BR /&gt;
&lt;BR /&gt;
"Steve Carter" &lt;SCARTER&gt; wrote in message&lt;BR /&gt;
news:FD9DB81516719FC69756CD162F1F0835@in.WebX.SaUCah8kaAW...&lt;BR /&gt;
&amp;gt; i have created two UDL's, one for ACCESS and the other for SQL Server.  my&lt;BR /&gt;
&amp;gt; SQL statement is:&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;      xRS.Open "SELECT NAME FROM PEDESTAL GROUP BY NAME", db, adOpenKeyset,&lt;BR /&gt;
&amp;gt; adLockOptimistic&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; when i run the SQL statement attached through the ACCESS UDL, the result&lt;BR /&gt;
is&lt;BR /&gt;
&amp;gt; grouped properly with the record count set to the correct number of&lt;BR /&gt;
records.&lt;BR /&gt;
&amp;gt; when i run the same SQL statement in SQL Server attached through the SQL&lt;BR /&gt;
&amp;gt; Server UDL, i return only one record and the record count is set to "-1".&lt;BR /&gt;
&amp;gt; any ideas why the SQL Server is not returning the correct number of&lt;BR /&gt;
records?&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; (if i remove the "GROUP BY NAME" from the SQL statement, both queries&lt;BR /&gt;
return&lt;BR /&gt;
&amp;gt; the same number of records, as it should...)&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; --&lt;BR /&gt;
&amp;gt; sc&lt;BR /&gt;
&amp;gt; Mid-State Consultants&lt;BR /&gt;
&amp;gt; scarter@mscon.com&lt;BR /&gt;
&amp;gt;&lt;/SCARTER&gt;</description>
    <pubDate>Wed, 10 Jan 2001 05:22:56 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2001-01-10T05:22:56Z</dc:date>
    <item>
      <title>ACCESS vs. SQL Server - SQL statement...</title>
      <link>https://forums.autodesk.com/t5/vba-forum/access-vs-sql-server-sql-statement/m-p/334274#M88101</link>
      <description>i have created two UDL's, one for ACCESS and the other for SQL Server.  my&lt;BR /&gt;
SQL statement is:&lt;BR /&gt;
&lt;BR /&gt;
     xRS.Open "SELECT NAME FROM PEDESTAL GROUP BY NAME", db, adOpenKeyset,&lt;BR /&gt;
adLockOptimistic&lt;BR /&gt;
&lt;BR /&gt;
when i run the SQL statement attached through the ACCESS UDL, the result is&lt;BR /&gt;
grouped properly with the record count set to the correct number of records.&lt;BR /&gt;
when i run the same SQL statement in SQL Server attached through the SQL&lt;BR /&gt;
Server UDL, i return only one record and the record count is set to "-1".&lt;BR /&gt;
any ideas why the SQL Server is not returning the correct number of records?&lt;BR /&gt;
&lt;BR /&gt;
(if i remove the "GROUP BY NAME" from the SQL statement, both queries return&lt;BR /&gt;
the same number of records, as it should...)&lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
sc&lt;BR /&gt;
Mid-State Consultants&lt;BR /&gt;
scarter@mscon.com</description>
      <pubDate>Tue, 09 Jan 2001 13:31:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/access-vs-sql-server-sql-statement/m-p/334274#M88101</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-01-09T13:31:34Z</dc:date>
    </item>
    <item>
      <title>Re: ACCESS vs. SQL Server - SQL statement...</title>
      <link>https://forums.autodesk.com/t5/vba-forum/access-vs-sql-server-sql-statement/m-p/334275#M88102</link>
      <description>I suggest you check your err object.. I suspect that there is a problem in&lt;BR /&gt;
the way you open the recordset in combination with the chosen driver.&lt;BR /&gt;
&lt;BR /&gt;
Wouter&lt;BR /&gt;
&lt;BR /&gt;
"Steve Carter" &lt;SCARTER&gt; wrote in message&lt;BR /&gt;
news:FD9DB81516719FC69756CD162F1F0835@in.WebX.SaUCah8kaAW...&lt;BR /&gt;
&amp;gt; i have created two UDL's, one for ACCESS and the other for SQL Server.  my&lt;BR /&gt;
&amp;gt; SQL statement is:&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;      xRS.Open "SELECT NAME FROM PEDESTAL GROUP BY NAME", db, adOpenKeyset,&lt;BR /&gt;
&amp;gt; adLockOptimistic&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; when i run the SQL statement attached through the ACCESS UDL, the result&lt;BR /&gt;
is&lt;BR /&gt;
&amp;gt; grouped properly with the record count set to the correct number of&lt;BR /&gt;
records.&lt;BR /&gt;
&amp;gt; when i run the same SQL statement in SQL Server attached through the SQL&lt;BR /&gt;
&amp;gt; Server UDL, i return only one record and the record count is set to "-1".&lt;BR /&gt;
&amp;gt; any ideas why the SQL Server is not returning the correct number of&lt;BR /&gt;
records?&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; (if i remove the "GROUP BY NAME" from the SQL statement, both queries&lt;BR /&gt;
return&lt;BR /&gt;
&amp;gt; the same number of records, as it should...)&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; --&lt;BR /&gt;
&amp;gt; sc&lt;BR /&gt;
&amp;gt; Mid-State Consultants&lt;BR /&gt;
&amp;gt; scarter@mscon.com&lt;BR /&gt;
&amp;gt;&lt;/SCARTER&gt;</description>
      <pubDate>Tue, 09 Jan 2001 14:03:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/access-vs-sql-server-sql-statement/m-p/334275#M88102</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-01-09T14:03:19Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/access-vs-sql-server-sql-statement/m-p/334276#M88103</link>
      <description>i have reviewed the error count associated with his object, it was 0.  i&lt;BR /&gt;
have exhausted all the possibilities of the way the record set is being&lt;BR /&gt;
opened, still no success.  what did you mean by "driver"?&lt;BR /&gt;
&lt;BR /&gt;
i am beginning to suspect that the "GROUP BY" is creating the problem.  this&lt;BR /&gt;
conclusion is due to other operators (like "ORDER BY") which work, but the&lt;BR /&gt;
"GROUP BY" does not.&lt;BR /&gt;
&lt;BR /&gt;
thanks for the help.&lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
sc&lt;BR /&gt;
Mid-State Consultants&lt;BR /&gt;
scarter@mscon.com&lt;BR /&gt;
"Wouter van Eck" &lt;WOUTER&gt; wrote in message&lt;BR /&gt;
news:EEEA39D36145AE3F5D6B0F95876133AF@in.WebX.SaUCah8kaAW...&lt;BR /&gt;
&amp;gt; I suggest you check your err object.. I suspect that there is a problem in&lt;BR /&gt;
&amp;gt; the way you open the recordset in combination with the chosen driver.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Wouter&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; "Steve Carter" &lt;SCARTER&gt; wrote in message&lt;BR /&gt;
&amp;gt; news:FD9DB81516719FC69756CD162F1F0835@in.WebX.SaUCah8kaAW...&lt;BR /&gt;
&amp;gt; &amp;gt; i have created two UDL's, one for ACCESS and the other for SQL Server.&lt;BR /&gt;
my&lt;BR /&gt;
&amp;gt; &amp;gt; SQL statement is:&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt;      xRS.Open "SELECT NAME FROM PEDESTAL GROUP BY NAME", db,&lt;BR /&gt;
adOpenKeyset,&lt;BR /&gt;
&amp;gt; &amp;gt; adLockOptimistic&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; when i run the SQL statement attached through the ACCESS UDL, the result&lt;BR /&gt;
&amp;gt; is&lt;BR /&gt;
&amp;gt; &amp;gt; grouped properly with the record count set to the correct number of&lt;BR /&gt;
&amp;gt; records.&lt;BR /&gt;
&amp;gt; &amp;gt; when i run the same SQL statement in SQL Server attached through the SQL&lt;BR /&gt;
&amp;gt; &amp;gt; Server UDL, i return only one record and the record count is set to&lt;BR /&gt;
"-1".&lt;BR /&gt;
&amp;gt; &amp;gt; any ideas why the SQL Server is not returning the correct number of&lt;BR /&gt;
&amp;gt; records?&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; (if i remove the "GROUP BY NAME" from the SQL statement, both queries&lt;BR /&gt;
&amp;gt; return&lt;BR /&gt;
&amp;gt; &amp;gt; the same number of records, as it should...)&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; --&lt;BR /&gt;
&amp;gt; &amp;gt; sc&lt;BR /&gt;
&amp;gt; &amp;gt; Mid-State Consultants&lt;BR /&gt;
&amp;gt; &amp;gt; scarter@mscon.com&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt;&lt;/SCARTER&gt;&lt;/WOUTER&gt;</description>
      <pubDate>Tue, 09 Jan 2001 20:00:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/access-vs-sql-server-sql-statement/m-p/334276#M88103</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-01-09T20:00:27Z</dc:date>
    </item>
    <item>
      <title>Re: ACCESS vs. SQL Server - SQL statement...</title>
      <link>https://forums.autodesk.com/t5/vba-forum/access-vs-sql-server-sql-statement/m-p/334277#M88104</link>
      <description>Try replacing GROUP BY NAME with GROUP BY 1, which is a column number for&lt;BR /&gt;
the returned recordset.  And try adding a semi-colon at the end of the&lt;BR /&gt;
SELECT.&lt;BR /&gt;
--&lt;BR /&gt;
John Goodfellow&lt;BR /&gt;
irtf'nm&lt;BR /&gt;
use 'microtouch' in address to email&lt;BR /&gt;
&lt;BR /&gt;
"Steve Carter" &lt;SCARTER&gt; wrote in message&lt;BR /&gt;
news:FD9DB81516719FC69756CD162F1F0835@in.WebX.SaUCah8kaAW...&lt;BR /&gt;
&amp;gt; i have created two UDL's, one for ACCESS and the other for SQL Server.  my&lt;BR /&gt;
&amp;gt; SQL statement is:&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;      xRS.Open "SELECT NAME FROM PEDESTAL GROUP BY NAME", db, adOpenKeyset,&lt;BR /&gt;
&amp;gt; adLockOptimistic&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; when i run the SQL statement attached through the ACCESS UDL, the result&lt;BR /&gt;
is&lt;BR /&gt;
&amp;gt; grouped properly with the record count set to the correct number of&lt;BR /&gt;
records.&lt;BR /&gt;
&amp;gt; when i run the same SQL statement in SQL Server attached through the SQL&lt;BR /&gt;
&amp;gt; Server UDL, i return only one record and the record count is set to "-1".&lt;BR /&gt;
&amp;gt; any ideas why the SQL Server is not returning the correct number of&lt;BR /&gt;
records?&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; (if i remove the "GROUP BY NAME" from the SQL statement, both queries&lt;BR /&gt;
return&lt;BR /&gt;
&amp;gt; the same number of records, as it should...)&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; --&lt;BR /&gt;
&amp;gt; sc&lt;BR /&gt;
&amp;gt; Mid-State Consultants&lt;BR /&gt;
&amp;gt; scarter@mscon.com&lt;BR /&gt;
&amp;gt;&lt;/SCARTER&gt;</description>
      <pubDate>Wed, 10 Jan 2001 05:22:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/access-vs-sql-server-sql-statement/m-p/334277#M88104</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-01-10T05:22:56Z</dc:date>
    </item>
    <item>
      <title>Re: ACCESS vs. SQL Server - SQL statement...</title>
      <link>https://forums.autodesk.com/t5/vba-forum/access-vs-sql-server-sql-statement/m-p/334278#M88105</link>
      <description>I'm guessing your problem is the adOpenKeyset.  I'd have to go look but&lt;BR /&gt;
isn't that opening the recordset for editing?  Try a different option like&lt;BR /&gt;
adOpenForwardOnly there and see if it works.&lt;BR /&gt;
&lt;BR /&gt;
"Steve Carter" &lt;SCARTER&gt; wrote in message&lt;BR /&gt;
news:FD9DB81516719FC69756CD162F1F0835@in.WebX.SaUCah8kaAW...&lt;BR /&gt;
&amp;gt; i have created two UDL's, one for ACCESS and the other for SQL Server.  my&lt;BR /&gt;
&amp;gt; SQL statement is:&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;      xRS.Open "SELECT NAME FROM PEDESTAL GROUP BY NAME", db, adOpenKeyset,&lt;BR /&gt;
&amp;gt; adLockOptimistic&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; when i run the SQL statement attached through the ACCESS UDL, the result&lt;BR /&gt;
is&lt;BR /&gt;
&amp;gt; grouped properly with the record count set to the correct number of&lt;BR /&gt;
records.&lt;BR /&gt;
&amp;gt; when i run the same SQL statement in SQL Server attached through the SQL&lt;BR /&gt;
&amp;gt; Server UDL, i return only one record and the record count is set to "-1".&lt;BR /&gt;
&amp;gt; any ideas why the SQL Server is not returning the correct number of&lt;BR /&gt;
records?&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; (if i remove the "GROUP BY NAME" from the SQL statement, both queries&lt;BR /&gt;
return&lt;BR /&gt;
&amp;gt; the same number of records, as it should...)&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; --&lt;BR /&gt;
&amp;gt; sc&lt;BR /&gt;
&amp;gt; Mid-State Consultants&lt;BR /&gt;
&amp;gt; scarter@mscon.com&lt;BR /&gt;
&amp;gt;&lt;/SCARTER&gt;</description>
      <pubDate>Wed, 10 Jan 2001 08:40:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/access-vs-sql-server-sql-statement/m-p/334278#M88105</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-01-10T08:40:58Z</dc:date>
    </item>
    <item>
      <title>Re: ACCESS vs. SQL Server - SQL statement...</title>
      <link>https://forums.autodesk.com/t5/vba-forum/access-vs-sql-server-sql-statement/m-p/334279#M88106</link>
      <description>Steve,&lt;BR /&gt;
&lt;BR /&gt;
	the problem that you get with SQL Server is probably not so much the&lt;BR /&gt;
SQL Server options, but what object you are using to attach to the&lt;BR /&gt;
server.&lt;BR /&gt;
&lt;BR /&gt;
	Are you using DAO for the Access stuff and ADO for the SQL Server&lt;BR /&gt;
stuff?&lt;BR /&gt;
	&lt;BR /&gt;
	When you query an SQL server, it doesn't return the number of records,&lt;BR /&gt;
only whether the records returned are TRUE or FALSE.  There are obvious&lt;BR /&gt;
reasons for this, the simplest being that usually SQL Servers deal with&lt;BR /&gt;
far larger data sets and you are very unlikely to sort through large&lt;BR /&gt;
numbers of them.&lt;BR /&gt;
&lt;BR /&gt;
	The other thing you have to learn is that connecting to an SQL server&lt;BR /&gt;
is not the same as connecting to an Access server, as the interface&lt;BR /&gt;
changes because an SQL Server ALSO records the Username of the person&lt;BR /&gt;
accessing the table.  Note below I have two (2) dots between the&lt;BR /&gt;
database name and the table name.  That is telling the server that I am&lt;BR /&gt;
going to use the DEFAULT user name.&lt;BR /&gt;
&lt;BR /&gt;
	Whenever I use a "&amp;lt;" or a "&amp;gt;"... that means that the things between&lt;BR /&gt;
that are variables, and you replace that information WITH the symbols. &lt;BR /&gt;
i.e.  &lt;DATABASENAME&gt; becomes YourDatabase&lt;BR /&gt;
&lt;BR /&gt;
	You can use a conditional loop at the after you have found the records&lt;BR /&gt;
to sort through them if you require that.&lt;BR /&gt;
&lt;BR /&gt;
SQLString1 = "DRIVER={SQL&lt;BR /&gt;
Server};SERVER=&lt;SERVERNAME&gt;;DATABASE=&lt;DATABASENAME&gt;;UID=&lt;USERNAME&gt;;PWD=&lt;USERPASSWORD&gt;;APP=&lt;APPLICATIONNAME&gt;;"&lt;BR /&gt;
conCAD.Open SQLString1&lt;BR /&gt;
&lt;BR /&gt;
SQLString1 = "SELECT * "&lt;BR /&gt;
SQLString1 = SQLString1 &amp;amp; " FROM [&lt;DATABASENAME&gt;]..[&lt;TABLENAME&gt;]"&lt;BR /&gt;
SQLString1 = SQLString1 &amp;amp; " WHERE&lt;BR /&gt;
[&lt;DATABASENAME&gt;]..[&lt;TABLENAME&gt;].[&lt;FIELDNAME1&gt;] = '&lt;CRITERIA&gt;'"&lt;BR /&gt;
SQLString1 = SQLString1 &amp;amp; " ORDER BY&lt;BR /&gt;
[&lt;DATABASENAME&gt;]..[&lt;TABLENAME&gt;].[&lt;FIELDNAME1&gt;] DESC"&lt;BR /&gt;
&lt;BR /&gt;
Set rsLSDumpStatus = New ADODB.Recordset&lt;BR /&gt;
Call rsLSDumpStatus.Open(SQLString1, conCAD, adOpenDynamic)&lt;BR /&gt;
&lt;BR /&gt;
If IsNull(rsLSDumpStatus.Fields(0)) = False Then&lt;BR /&gt;
   If rsLSDumpStatus.BOF = True And rsLSDumpStatus.EOF = True Then&lt;BR /&gt;
	'	This means that no record is found&lt;BR /&gt;
&lt;BR /&gt;
   Else&lt;BR /&gt;
	'	This means that some records ARE found&lt;BR /&gt;
&lt;BR /&gt;
   End If&lt;BR /&gt;
End If&lt;BR /&gt;
&lt;BR /&gt;
Steve Carter wrote:&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; i have created two UDL's, one for ACCESS and the other for SQL Server.  my&lt;BR /&gt;
&amp;gt; SQL statement is:&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt;      xRS.Open "SELECT NAME FROM PEDESTAL GROUP BY NAME", db, adOpenKeyset,&lt;BR /&gt;
&amp;gt; adLockOptimistic&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; when i run the SQL statement attached through the ACCESS UDL, the result is&lt;BR /&gt;
&amp;gt; grouped properly with the record count set to the correct number of records.&lt;BR /&gt;
&amp;gt; when i run the same SQL statement in SQL Server attached through the SQL&lt;BR /&gt;
&amp;gt; Server UDL, i return only one record and the record count is set to "-1".&lt;BR /&gt;
&amp;gt; any ideas why the SQL Server is not returning the correct number of records?&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; (if i remove the "GROUP BY NAME" from the SQL statement, both queries return&lt;BR /&gt;
&amp;gt; the same number of records, as it should...)&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; --&lt;BR /&gt;
&amp;gt; sc&lt;BR /&gt;
&amp;gt; Mid-State Consultants&lt;BR /&gt;
&amp;gt; scarter@mscon.com&lt;/FIELDNAME1&gt;&lt;/TABLENAME&gt;&lt;/DATABASENAME&gt;&lt;/CRITERIA&gt;&lt;/FIELDNAME1&gt;&lt;/TABLENAME&gt;&lt;/DATABASENAME&gt;&lt;/TABLENAME&gt;&lt;/DATABASENAME&gt;&lt;/APPLICATIONNAME&gt;&lt;/USERPASSWORD&gt;&lt;/USERNAME&gt;&lt;/DATABASENAME&gt;&lt;/SERVERNAME&gt;&lt;/DATABASENAME&gt;</description>
      <pubDate>Sun, 28 Jan 2001 21:16:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/access-vs-sql-server-sql-statement/m-p/334279#M88106</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-01-28T21:16:04Z</dc:date>
    </item>
  </channel>
</rss>

