
Data Report without Data Environment
Briefly:
Go to Project->References and check Microsoft Active Data Object x.y
(current version is 2.6 and it is STRONGLY recommended that you update your
version (if necessary) - visit www.microsoft.com/data )
Dim dcn As ADODB.Connection
Dim rs As ADODB.Recordset
'
'
Set dcn = New ADODB.Connection
Set rs = New ADODB.Recordset
dcn.connectionstring = "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=c:\my
documents\database.mdb"
'MS Jet 3.51 is the provider for MS Access 97 etc etc, database.mdb is
Access file you want to open...
dcn.open
rs.cursorlocation=adUseClient
rs.Open "SELECT * FROM table",dcn ' sure you can use your own SQL
statment here
..
' now let's say you use Microsoft Data Grid control to display the data
(DataGrid1 is on the Form or wherever)
Set DataGrid1.DataSource = rs
DataGrid1.Refresh
..
..
rs.close
dcn.close
set rs=nothing
set dcn=nothing
etc etc
Get yourself a book on ADO !!! :)))
---------
degojs
'
'
'
Quote:
> Hi
> Does anyone have an example of linking ADO recordset (generated by code)
to
> a Data Report without using a Data Environment?
> I really appreciate you reply in advance.
> Regards
> Med