Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

datareport

Status
Not open for further replies.

makisbest

Technical User
Mar 3, 2005
125
GR
Hi all
I have this code

Private Sub Form_Load()
' **** Create Connection and Recordset Objects ****
Dim cnConn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim strsql As String

' **** Instantiate the new objects ****
Set cnConn = New ADODB.Connection
Set rs = New ADODB.Recordset

' **** Set up connection String ****
With cnConn
.Provider = "SQLOLEDB.1"
.Properties("Data Source").Value = "www"
.Properties("User ID").Value = "clroot"
.Properties("Password").Value = "clroot"
.Properties("Initial Catalog").Value = "iosif"
.CursorLocation = adUseClient
.ConnectionTimeout = 0
.Open
End With

' **** String to pass to the connection to get records back ****
strsql = "select * from salesman"

' **** Open Records for readonly ****
rs.Open strsql, cnConn, adOpenStatic, adLockReadOnly

How I can pass values from table salesman into a datareport1?

thank you
 
Set datareport1.recordsource = rs

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
I don't understand.

I have the field code,name,address.
Then what?
 
Just use the recordset that you have opened (in your code, rs) and set the datareport datasource property to the recordset.

MSDN reference:

There are also several other posts in this forum covering datareports

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top