| | |
Vb6 Data Report Repeatedly Shows Previous Report
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Aug 2007
Posts: 8
Reputation:
Solved Threads: 0
Hi, I am a new member in this site. I am also just learning VB6. I made some progress in programming a report generator for my farm. However, after having designed a report using Data Report designer, I keep getting the same result or reports repeatedly although I have changed some parameters already. There's a need to click on the command button twice or reprocess the report twice just to get the desired data. Otherwise, old data on the reports remains which was actually the result of previous report processing. There seems to be a cache that keeps throwing the same data repeatedly although another recordsets of data have already been saved in the source table. I use Data Environment as data source for my report, Data Access Object for my forms and MS Access as database repository. Thanks.
Hi,
Before showing the report just Refresh it..:
Regards
Veena
Before showing the report just Refresh it..:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
DataReport1.Refresh DataReport1.Show
Regards
Veena
Hi,
u can try this :
Change the dataenv and command names..
Regards
Veena
u can try this :
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
dataenv.Command1.Open dataenv.Command1.Requery DataReport1.Refresh DataReport1.Show
Change the dataenv and command names..
Regards
Veena
I don't know if you found a solution but I fixed this by setting the Report Data Source to nothing and then assigning it again to the Data Environment like this:
Do this before doing anything and that should fix the problem.
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Set DataReport1.DataSource = Nothing Set DataReport1.DataSource = DataEnvironment1
Do this before doing anything and that should fix the problem.
•
•
Join Date: Aug 2007
Posts: 8
Reputation:
Solved Threads: 0
Rich, Thanks for your reply. I just tried it. Didn't work for me. I fetch a set of data records that could fill up to 7 columnar pages (e.g. feed requirements of a huge number of sows. very important for us farmers to forecast budgeting and raw materials). I think the size of the data being generated is pushing MS access or MS Jet4.0 provider to the limit. (not sure). I tried for the past few days to do all sorts of initializing the data environment, tables and data object but causing another error "failing to get row sets" (whatever). In the meantime, I am just contented with clicking the command button one more time as if refreshing the displayed report the 2nd time. Hey, that is what is available in Crystal Reports but unfortunately it's not available in my town as yet. At least, Im happy enough for now clicking my Ok button twice. Really appreciate your concern to newbies like me.
•
•
•
•
I don't know if you found a solution but I fixed this by setting the Report Data Source to nothing and then assigning it again to the Data Environment like this:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Set DataReport1.DataSource = Nothing Set DataReport1.DataSource = DataEnvironment1
Do this before doing anything and that should fix the problem.
•
•
Join Date: Aug 2007
Posts: 8
Reputation:
Solved Threads: 0
Here is that part of the code where I show my datareport1:
Private Sub cmdOk_Click()
'========================
Dim nYear As Integer
nYear = nVal(cmbFromYear.Text)
isDiscounted = chkDiscounted.Value
isSumReport = chkSumReport.Value
dStartDate = cmbFromMonth.Text & " 01, " & cmbFromYear.Text
dStartDate = Format(dStartDate, "MM/dd/YYYY")
dEndDate = cmbEndMonth.Text & " 28, " & cmbEndYear.Text 'part of determining
dEndDate = Format(dEndDate, "MM/dd/YYYY") 'last date of the month.
dEndDate = xLastDay(dEndDate) 'Ending date to report
'Check correctnext of month entered
If Trim(cmbFromMonth.Text) = "" Or Not MonthNameOk(cmbFromMonth.Text) Then
MsgBox "Enter a proper starting month name! ", vbExclamation, "Wrong entry"
cmbFromMonth.SetFocus
Exit Sub
End If
If Trim(cmbEndMonth.Text) = "" Or Not MonthNameOk(cmbEndMonth.Text) Then
MsgBox "Enter a proper ending month name! ", vbExclamation, "Wrong entry"
cmbEndMonth.SetFocus
Exit Sub
End If
If cmbEndMonth.ListIndex < cmbFromMonth.ListIndex And _
nVal(cmbEndYear.Text) <= nVal(cmbFromYear.Text) Then
MsgBox "Starting month cannot be greater than ending month!", vbExclamation, "Wrong entry"
Exit Sub
End If
'Check correctness of year number entered.
If nVal(cmbFromYear.Text) < Year(Date) Then
MsgBox "Enter a proper starting year!", vbExclamation, "Wrong entry"
Exit Sub
End If
If nVal(cmbEndYear.Text) < Year(Date) Then
MsgBox "Enter a proper ending year!", vbExclamation, "Wrong entry"
Exit Sub
End If
If nVal(cmbEndYear.Text) < nVal(cmbFromYear.Text) Then
MsgBox "Starting year cannot be later than ending year!", vbExclamation, "Wrong entry"
Exit Sub
End If
Me.MousePointer = vbHourglass
'Clean report file or RepoDetails table -> RepoDetails
With dtaRepoDetails.Recordset
If .RecordCount <> 0 Then
.MoveFirst
End If
While .EOF = False
.Delete 'Delete all records used by
.MoveNext 'previous reporting. This DAO table
Wend 'is used to contain all fetch data
End With 'prior to reporting
StoreReportDetails 'Save all data on a daily basis and save to REPODETAILS table
StoreReportWeekSummary 'Summarizes data on a wkly basis and save REPOSUMMARY
Load dtaEnvPigs 'Environment using MSjet 4.0 OLE provider with SQL command:
' SELECT YearNr, monthnr, weeknr, tagnr, PigAge, pigtype,
' feedcode, feedname,heads, eachmealkg, totalcost,
' totalkg, bags FROM REPOSUMMARY
With dtaEnvPigs
If .RepoSummary.State <> 0 Then
dtaEnvPigs.RepoSummary.Close 'Close the environment after loading
End If 'hoping the close,open procedure will[/COLOR]
End With 'update the datareport1[/COLOR]
If Not isSumReport Then 'Two reports use this SUB
DataReport1.LeftMargin = 200
DataReport1.ReportWidth = 8865
DataReport1.Width = 9100
DataReport1.Refresh
If DataReport1.Visible = False Then DataReport1.Show 1
Else
DataReport4.LeftMargin = 200
DataReport4.ReportWidth = 8865
DataReport4.Width = 9100
DataReport4.Refresh
If DataReport4.Visible = False Then DataReport4.Show
End If
Unload dtaEnvPigs
Me.MousePointer = vbNormal
dtaRepoSum.Refresh
End Sub
Private Sub cmdOk_Click()
'========================
Dim nYear As Integer
nYear = nVal(cmbFromYear.Text)
isDiscounted = chkDiscounted.Value
isSumReport = chkSumReport.Value
dStartDate = cmbFromMonth.Text & " 01, " & cmbFromYear.Text
dStartDate = Format(dStartDate, "MM/dd/YYYY")
dEndDate = cmbEndMonth.Text & " 28, " & cmbEndYear.Text 'part of determining
dEndDate = Format(dEndDate, "MM/dd/YYYY") 'last date of the month.
dEndDate = xLastDay(dEndDate) 'Ending date to report
'Check correctnext of month entered
If Trim(cmbFromMonth.Text) = "" Or Not MonthNameOk(cmbFromMonth.Text) Then
MsgBox "Enter a proper starting month name! ", vbExclamation, "Wrong entry"
cmbFromMonth.SetFocus
Exit Sub
End If
If Trim(cmbEndMonth.Text) = "" Or Not MonthNameOk(cmbEndMonth.Text) Then
MsgBox "Enter a proper ending month name! ", vbExclamation, "Wrong entry"
cmbEndMonth.SetFocus
Exit Sub
End If
If cmbEndMonth.ListIndex < cmbFromMonth.ListIndex And _
nVal(cmbEndYear.Text) <= nVal(cmbFromYear.Text) Then
MsgBox "Starting month cannot be greater than ending month!", vbExclamation, "Wrong entry"
Exit Sub
End If
'Check correctness of year number entered.
If nVal(cmbFromYear.Text) < Year(Date) Then
MsgBox "Enter a proper starting year!", vbExclamation, "Wrong entry"
Exit Sub
End If
If nVal(cmbEndYear.Text) < Year(Date) Then
MsgBox "Enter a proper ending year!", vbExclamation, "Wrong entry"
Exit Sub
End If
If nVal(cmbEndYear.Text) < nVal(cmbFromYear.Text) Then
MsgBox "Starting year cannot be later than ending year!", vbExclamation, "Wrong entry"
Exit Sub
End If
Me.MousePointer = vbHourglass
'Clean report file or RepoDetails table -> RepoDetails
With dtaRepoDetails.Recordset
If .RecordCount <> 0 Then
.MoveFirst
End If
While .EOF = False
.Delete 'Delete all records used by
.MoveNext 'previous reporting. This DAO table
Wend 'is used to contain all fetch data
End With 'prior to reporting
StoreReportDetails 'Save all data on a daily basis and save to REPODETAILS table
StoreReportWeekSummary 'Summarizes data on a wkly basis and save REPOSUMMARY
Load dtaEnvPigs 'Environment using MSjet 4.0 OLE provider with SQL command:
' SELECT YearNr, monthnr, weeknr, tagnr, PigAge, pigtype,
' feedcode, feedname,heads, eachmealkg, totalcost,
' totalkg, bags FROM REPOSUMMARY
With dtaEnvPigs
If .RepoSummary.State <> 0 Then
dtaEnvPigs.RepoSummary.Close 'Close the environment after loading
End If 'hoping the close,open procedure will[/COLOR]
End With 'update the datareport1[/COLOR]
If Not isSumReport Then 'Two reports use this SUB
DataReport1.LeftMargin = 200
DataReport1.ReportWidth = 8865
DataReport1.Width = 9100
DataReport1.Refresh
If DataReport1.Visible = False Then DataReport1.Show 1
Else
DataReport4.LeftMargin = 200
DataReport4.ReportWidth = 8865
DataReport4.Width = 9100
DataReport4.Refresh
If DataReport4.Visible = False Then DataReport4.Show
End If
Unload dtaEnvPigs
Me.MousePointer = vbNormal
dtaRepoSum.Refresh
End Sub
•
•
•
•
Rich, Thanks for your reply. I just tried it. Didn't work for me. I fetch a set of data records that could fill up to 7 columnar pages (e.g. feed requirements of a huge number of sows. very important for us farmers to forecast budgeting and raw materials). I think the size of the data being generated is pushing MS access or MS Jet4.0 provider to the limit. (not sure). I tried for the past few days to do all sorts of initializing the data environment, tables and data object but causing another error "failing to get row sets" (whatever). In the meantime, I am just contented with clicking the command button one more time as if refreshing the displayed report the 2nd time. Hey, that is what is available in Crystal Reports but unfortunately it's not available in my town as yet. At least, Im happy enough for now clicking my Ok button twice. Really appreciate your concern to newbies like me.
Last edited by genie_ps; Aug 22nd, 2007 at 10:50 am. Reason: Trying to show it clear
![]() |
Similar Threads
- How add Crystal Report Version 11 in VB6 (Visual Basic 4 / 5 / 6)
- Data Report in vb 6.0 (Visual Basic 4 / 5 / 6)
- memory management in wndows 2000 (Windows NT / 2000 / XP)
- problem connection vb6 & crystal report 11 (Visual Basic 4 / 5 / 6)
- ASP.NET Crystal Report ODBC MySQL (ASP.NET)
- Crystal report (VB.NET)
- Help in understanding Adwords conversion tracking report (Search Engine Optimization)
- Trouble positioning report type of page (HTML and CSS)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: get file name but NOT with the common dialog option
- Next Thread: MSFlexgrid Click event
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age append application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver subroutine table tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





