(Sorry for the cross posting)

Guys

I am getting into SQL (wow powerful or what?)

Anyway I have a really simple question (and embarrassing one).
I am opening the DB and passing in a SQL query that sums a few fields and
returns the value in a 'temporary' table called wire_length

eg SELECT SUM(Length) AS wire_length FROM LOOP WHERE PartNo = '610972'

I have checked this query in Access and it works ok. I now want to put it
into VB

Here is the code

    Set adoConnection = New ADODB.Connection
    Set adoRecordset = New ADODB.Recordset

    strTemp = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strLoopName
& ";Persist Security Info=False"
    adoConnection.Open strTemp

    strSQL = "SELECT SUM(Length) AS wire_length FROM LOOP WHERE PartNo = '"
& strPartNo & "'"

    adoRecordset.Open strSQL, adoConnection

'    adoRecordset.Close
'    adoConnection.Close
    Set adoConnection = Nothing
    Set adoRecordset = Nothing

Question

How do I access the summed value in VB???? To date I have only used SQL to
add and delete items in the DB so this is new stuff for me.

I.E I want to add a line like sngSum = ???????????

Told you it was simple :-)

Oh and another one,,,

Why is it that I have to comment out the lines adoRecordset.Close and
adoConnection.Close when doing a query?
Does a query automatically close the DB???


Mucho thanks



Julian Holt


[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/k7folB/TM
---------------------------------------------------------------------~->


'// =======================================================
    Rules : http://ReliableAnswers.com/List/Rules.asp
    Home  : http://groups.yahoo.com/group/vbHelp/
    =======================================================
    Post  : [EMAIL PROTECTED]
    Join  : [EMAIL PROTECTED]
    Leave : [EMAIL PROTECTED]
'// =======================================================
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/vbhelp/

<*> To unsubscribe from this group, send an email to:
     [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 

Reply via email to