Click to See Complete Forum and Search --> : The data report can't be updated
maqiang
May 24th, 1999, 12:57 AM
I create a data report using data environment in visual basic 6.0. The report is based on a table.But when I changed the records in the database at run time and show the report again, the report can't be updated and it shows the same records in the origianl table. Who know the solution?Thank you!
maqiang
June 1st, 1999, 01:30 AM
I have found the solution,you can set the datasource of the report
in run time. In the following code,"rpt" is the name of the data report.
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim sSql As String
Dim nCtrl As Integer
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
cn.ConnectionString = gsConnection
cn.Open
sSql = "select * from temp"
rs.Open sSql, cn, adOpenStatic, adLockOptimistic
Set rpt.DataSource = rs
rptOut.DataMember = ""
With rpt.Sections("secDetail").Controls
For nCtrl = 1 To .Count
If TypeOf .Item(nCtrl) Is RptTextBox Or _
TypeOf .Item(nCtrl) Is RptFunction Then
.Item(nCtrl).DataMember = ""
End If
Next nCtrl
End With
rpt.Show
rs.Close
cn.Close
Set rs = Nothing
Set cn = Nothing
ranjit
June 15th, 1999, 11:12 AM
Never used vb6 or did any reports in vb6 but had this problem in vb5 the soln there was there is an option call store report data with report we have to uncheck it and the report always queries the table for new data this was in the file menu. Try it , it may solve your problem . Please tell if it solves the problem
Mail Id ranjitus@hotmail.com
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.