Extract field names from a table/query ADO/DAO

Status
Not open for further replies.

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 13:09
Joined
Jul 9, 2003
Messages
16,919
I find myself using both DAO code and ADO code in the same functions. I am gradually learning how to change the old DAO into ADO. I have just succeeded with a routine for extracting the field names from a table, query. See attached for more information.

Any improvement, comments you can make welcome.
 

Attachments

Last edited:
Extract the Sum with ADO DB

Found it!

It has taken me hours and hours to find this piece of code!

Code:
Sub get_SQL_Sum()
'http://www.oreilly.com/pub/h/3323
  Dim conn As ADODB.Connection
  Set conn = CurrentProject.Connection
  Dim rs As New ADODB.Recordset
  rs.Open "Select Sum(Amount) As SumOfAmount From Invoices" & _
    " Where InvoiceDate=#12/10/04#", _
           conn, adOpenKeyset, adLockOptimistic
  MsgBox rs.Fields("SumOfAmount")
  rs.Close
  Set rs = Nothing
  Set conn = Nothing
End Sub
 
Last edited:
Status
Not open for further replies.

Users who are viewing this thread

Back
Top Bottom