943,823 Members | Top Members by Rank

Ad:
You are currently viewing page 1 of this multi-page discussion thread
Aug 12th, 2007
0

Vb6 Data Report Repeatedly Shows Previous Report

Expand Post »
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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
genie_ps is offline Offline
8 posts
since Aug 2007
Aug 12th, 2007
0

Re: Vb6 Data Report Repeatedly Shows Previous Report

Hi,

Before showing the report just Refresh it..:

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. DataReport1.Refresh
  2. DataReport1.Show

Regards
Veena
Reputation Points: 84
Solved Threads: 140
Posting Shark
QVeen72 is offline Offline
923 posts
since Nov 2006
Aug 12th, 2007
0

Re: Vb6 Data Report Repeatedly Shows Previous Report

Veena, thanks for the prompt reply. But, I already tried that and no success.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
genie_ps is offline Offline
8 posts
since Aug 2007
Aug 12th, 2007
0

Re: Vb6 Data Report Repeatedly Shows Previous Report

Hi,

u can try this :

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. dataenv.Command1.Open
  2. dataenv.Command1.Requery
  3. DataReport1.Refresh
  4. DataReport1.Show

Change the dataenv and command names..

Regards
Veena
Reputation Points: 84
Solved Threads: 140
Posting Shark
QVeen72 is offline Offline
923 posts
since Nov 2006
Aug 12th, 2007
0

Re: Vb6 Data Report Repeatedly Shows Previous Report

Veena, thanks again. Tried that too, still no luck.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
genie_ps is offline Offline
8 posts
since Aug 2007
Aug 12th, 2007
0

Re: Vb6 Data Report Repeatedly Shows Previous Report

Hi,

TryThis

Regards
Veena
Reputation Points: 84
Solved Threads: 140
Posting Shark
QVeen72 is offline Offline
923 posts
since Nov 2006
Aug 21st, 2007
0

Re: Vb6 Data Report Repeatedly Shows Previous Report

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)
  1. Set DataReport1.DataSource = Nothing
  2. Set DataReport1.DataSource = DataEnvironment1

Do this before doing anything and that should fix the problem.
Reputation Points: 10
Solved Threads: 1
Newbie Poster
Rich0001 is offline Offline
3 posts
since Aug 2007
Aug 21st, 2007
0

Re: Vb6 Data Report Repeatedly Shows Previous Report

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.

Click to Expand / Collapse  Quote originally posted by Rich0001 ...
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)
  1. Set DataReport1.DataSource = Nothing
  2. Set DataReport1.DataSource = DataEnvironment1

Do this before doing anything and that should fix the problem.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
genie_ps is offline Offline
8 posts
since Aug 2007
Aug 22nd, 2007
1

Re: Vb6 Data Report Repeatedly Shows Previous Report

Maybe somehow when you show the report, it's not updated yet, maybe it gets only updated after you click the ok(or whatever). If you send your code, someone might be able to catch your problem.
Reputation Points: 10
Solved Threads: 16
Posting Whiz in Training
plusplus is offline Offline
207 posts
since Jul 2007
Aug 22nd, 2007
0

Re: Vb6 Data Report Repeatedly Shows Previous Report

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

Click to Expand / Collapse  Quote originally posted by genie_ps ...
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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
genie_ps is offline Offline
8 posts
since Aug 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Parent - Child Command in vb6 Data Environment
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: string calculator





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC