Jump to content

Recommended Posts

Posted

Does anyone have an example (as simple as possible) showing how to use DAO to extract data and add data to a table in MS Access?

Thanks

Mike Lester

Basic stuff in this post should be a good start:

http://www.autoitscript.com/forum/index.ph...topic=19597&hl=

_SelectData()

Func _SelectData($dbname = "C:\FullPathToDatabase.mdb", $tblname = "MyTable", $T = "*")
$addfld = ObjCreate("ADODB.Connection")
$addfld.Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & $dbname)
$RS =ObjCreate("ADODB.Recordset")
$RS.ActiveConnection = $addfld
$RS.Open ("Select " & $T & " From " & $tblname )

msgbox(0,"", "Name: " & $RS.Fields(0).Name & " - Value: " & $RS.Fields(0).Value & @CRLF & "Name: " & $RS.Fields(1).Name & " - Value: " & $RS.Fields(1).Value & @CRLF & "Name: " & $RS.Fields(2).Name & " - Value: " & $RS.Fields(2).Value)

$RS.Close
$addfld.Close

EndFunc

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...