Extract field names from a table/query ADO/DAO (1 Viewer)

Status
Not open for further replies.

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 20:04
Joined
Jul 9, 2003
Messages
16,280
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

  • GetFldNamesDAO_And_ADO_Example.zip
    26.6 KB · Views: 5,022
Last edited:

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 20:04
Joined
Jul 9, 2003
Messages
16,280
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

Top Bottom