Page 1 of 1

error using ms access report and setting FunctionType.Period

Posted: Mon Nov 20, 2006 10:52 pm
by 9533066
I'm trying to add a function line to calculate an average on series0 in an ms access 2002 report using teechart v7.0.1.2 , with this code...

Code: Select all

  
  .AddSeries scLine
  'Define the Function Type for the new Series
  .Series(5).SetFunction tfAverage
  'Define the Datasource for the new Function Series
  'Use the existing Function (Series0) as input
  .Series(5).DataSource = "Series0"
  .Series(5).FunctionType.Period = 0

  .Series(5).CheckDataSource
however, I get an error upon running...
you have entered an expression that has an invalid reference to |

when I debug and try again I get a different error..
method 'period' of object iteefunction failed.

Anybody ever come across this before?

Posted: Tue Nov 21, 2006 9:57 am
by narcis
Hi jamjam,

It works fine for me here in VB6 and using this code:

Code: Select all

    With TChart1
        'Create the source series
        .AddSeries scLine
        'Create the function series
        .AddSeries scLine
        TChart1.Series(0).FillSampleValues 10
        
      'Define the Function Type for the new Series
      .Series(1).SetFunction tfAverage
      'Define the Datasource for the new Function Series
      'Use the existing Function (Series0) as input
      .Series(1).DataSource = "Series0"
      .Series(1).FunctionType.Period = 0
    
      .Series(1).CheckDataSource
    End With
Does Series0 exist in your application? If the problem persists please send us a simple example project we can run "as-is" to reproduce the problem here.

You can post your files at news://www.steema.net/steema.public.attachments newsgroup.

Thanks in advance.

fixed , bug?

Posted: Tue Nov 21, 2006 10:08 pm
by 9533066
Thanks,
I fixed the problem with

Code: Select all

 .Series(5).SetFunction 5 'tfAverage
The tfAverage was showing up 'empty' during a debug. In vb6 it shows as 5. It seems to be an issue with MS Access. Do you have explicit definitions for all the functions that I could include in a global module?


I have another issue using access reports. The chart object flickers constantly when in design view. It also takes focus each flicker so that when I go to save the report the prompt to do so appears behind the report design window. Any ideas or should I post another request?

Regards
Sean

Posted: Wed Nov 22, 2006 9:03 am
by narcis
Hi Sean,
The tfAverage was showing up 'empty' during a debug. In vb6 it shows as 5. It seems to be an issue with MS Access. Do you have explicit definitions for all the functions that I could include in a global module?


Yes, you'll find a list of all TeeChart constants in TeeChartDefines.h at C:\Program Files\Steema Software\TeeChart Pro v7 ActiveX Control\Examples\Visual C++.
I have another issue using access reports. The chart object flickers constantly when in design view. It also takes focus each flicker so that when I go to save the report the prompt to do so appears behind the report design window. Any ideas or should I post another request?
Are you 100% sure that you are using v7.0.1.2? This was a bug in previous versions which was fixed and I can't reproduce it here with v7.0.1.2.

You could search your machine's registry for TeeChart7.ocx and check that there's only one TeeChart7.ocx version registered.

If the problem persists please send us a simple example we can run "as-is" to reproduce the problem here. You can post your files at news://www.steema.net/steema.public.attachments newsgroup.