Change table of report from Ms Access

Fastreport Studio for Microsoft Access come with a demo as below:

Private Sub Form_Load()
Set fr = CreateObject("FastReport.TfrxReport")
If Not Left(Application.CodeProject.Path, 1) = Left(CurDir, 1) Then ChDrive Left(Application.CodeProject.Path, 1)
ChDir (Application.CodeProject.Path)
fr.LoadReportFromFile (Application.CodeProject.Path + "\fr_and_access.fr3")
End Sub

There is ADOTable1 in the demo report (fr_and_access.fr3) where the TableName is bind to table1. How can I change the underlying table from table1 to another table under Microsoft Acess 2003?

Comments

  • edited 2:40AM
    smching wrote: »
    Fastreport Studio for Microsoft Access come with a demo as below:

    Private Sub Form_Load()
    Set fr = CreateObject("FastReport.TfrxReport")
    If Not Left(Application.CodeProject.Path, 1) = Left(CurDir, 1) Then ChDrive Left(Application.CodeProject.Path, 1)
    ChDir (Application.CodeProject.Path)
    fr.LoadReportFromFile (Application.CodeProject.Path + "\fr_and_access.fr3")
    End Sub

    There is ADOTable1 in the demo report (fr_and_access.fr3) where the TableName is bind to table1. How can I change the underlying table from table1 to another table under Microsoft Acess 2003?

    It is pretty easy. For example, you may modify demo in following way:

    Public ado_tbl As TfrxADOTable

    Private Sub Command3_Click()

    REM Here can be a new name of the table
    Set ado_tbl = fr.FindObject("ADOTable1")
    ado_tbl.TableName = "table1"
    Set ado_tbl = Nothing

    fr.DesignReport
    End Sub

Leave a Comment