This Code Will Show us that HOW CAN ACCESS DATA ON DATAREPORTS
This Code Will Show us that "HOW CAN ACCESS DATA ON DATAREPORTS"
API Declarations
' MICROSOFT ACTIVEX DATAOBJECTS RECORSSET 2.1 LIBRARY
' From PROJECT MENU (REFRENCES)
' Create DATABASE(db1) and Table(tb1) in MS ACCESS.
' Fields of tables are ID, NAME, MARKS
' Save database (db1) in D DRIVE
' put 3 textboxes (array) and 3 labels on form.
' add one command button and name it with CmdSHOWREPORT
' add datareport and name it DataReport1
' add 3 lables and 3 RptTextBoxes in detail section of datareport
' in DATAFIELD (property of RptTextBox) write field of Tables one by one
' after doing all above steps paste following code in ur codding section
' on getting error please contact me.i will help u
' wish u good luck & take very good care of ur self
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Rate This Code Will Show us that HOW CAN ACCESS DATA ON DATAREPORTS
(1(1 Vote))
mystr = "select * from tb1"
Set rs = con.Execute(mystr)
Set DataReport1.DataSource = rs
DataReport1.Show
End Sub
'connection with data base
Private Sub Form_Initialize()
''both ways of connecting r absolutely right
' con.Provider = "microsoft.jet.oledb.4.0;data source = C:\My Documents\db1.mdb"
' con.Open
con.Open "provider= microsoft.jet.oledb.4.0;data source = e:\db1.mdb"
rs.Open "tb1", con
Form1.Caption = "loaded successfully"
End Sub
'TO SET SOURCE OF THE DATA
Private Sub Form_Load()
For i = Text1.LBound To Text1.UBound
Set Text1(i).DataSource = rs
Next
End Sub
'TO SET fields of the data. FIELDS MUST BE SAME
Private Sub Form_Activate()
Text1(0).DataField = "ID" 'name of table field
Text1(1).DataField = "NAME" 'name of table field
Text1(2).DataField = "MARKS" 'name of table field
End Sub
This Code Will Show us that HOW CAN ACCESS DATA ON DATAREPORTS Comments
No comments yet — be the first to post one!
Post a Comment