Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL AGAIN

Status
Not open for further replies.

stallion

Programmer
Feb 22, 2000
14
GB
sorry everyone i am still not getting it:<br>
<br>
- you have a command button which contains the sql, when pressed how will i make the answer appear in a label, could you also explain it so i understand it<br>
THANKS
 
Example<br>
<br>
Dim rs As RecordSet<br>
Dim g_sql As String<br>
<br>
g_sql = &quot;SELECT SUM(BEDRAG) AS VERBEDRAG FROM TABEL WHERE FAKTUURNR = &quot; & CStr(oud_faktuurnr)<br>
Set rs = g_db.OpenRecordset(g_sql)<br>
<br>
Label.Caption = VERBEDRAG<br>
<br>
Eric<br>
<p>Eric De Decker<br><a href=mailto:vbg.be@vbgroup.nl>vbg.be@vbgroup.nl</a><br><a href= Visual Basic Center</a><br>
 
ok... here is another way...<br>
Sub Command_Click()<br>
Dim rs as RecordSet<br>
Dim strSQL as String<br>
<br>
strSQL = &quot;Select &lt;field1&gt;, &lt;field2&gt;,... &lt;fieldN&gt; from &lt;table1&gt;, &lt;table2&gt;,... &lt;tableN&gt; Where &lt;Exclusion1&gt; = &quot;Whatever I want to filter on&quot; and &lt;Exclusion2&gt; = &quot;Where ever else I want to filter on&quot; Group by &lt;any of the fields&gt;, &lt;next field&gt; Order by &lt;any of the fields&gt;, &lt;next field&gt; &quot;<br>
<br>
rs.open strSQL, Active_Connection,,,adCmdText<br>
<br>
Lable.Caption = rs.feilds(&quot;&lt;field1&gt;&quot;).Value<br>
<br>
End Sub<br>
<br>
Just a thought...<br>
<p> Chad<br><a href=mailto:tinman@hotbot.com>tinman@hotbot.com</a><br><a href= > </a><br>Tinman,<br>
Welcome to OZ.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top