Run FastReport Using VBA

maxhugenmaxhugen Australia
edited 7:58AM in FastReport .NET
We're gradually migrating an MS Access application to .NET. Details are:
- Application delivered to users from server via Terminal Server (TS).
- MySQL database

We have purchased licenses for FastReport as reporting engine.

Until the app is fully migrated to .NET, we would like to run some FR reports from MS Access using VBA.

Can anyone advise me how to do this, or point me to some resources that describe a methodology pls?

MTIA!

Comments

  • edited 7:58AM
    from msaccess vba, use shellexecute (https://msdn.microsoft.com/en-us/library/windows/desktop/bb762153(v=vs.85).aspx) to run dotnet program.
    you could shellexecute to pass parameters.

    and dotnet program contains this code:
                Using cnn As New OleDBConnection(mySQLConnString)
                    cnn.Open()
    
                    Using cmd As New OleDBCommand()
                        cmd.Connection = cnn
                        cmd.CommandType = CommandType.Text
                        cmd.CommandText = "SELECT * FROM myTable WHERE ID = ?"
                        cmd.Parameters.AddWithValue("ID", id)
                        Using dr As OleDBDataReader = cmd.ExecuteReader()
                            Using dt As New DataTable()
                                dt.Load(dr)
                                dt.TableName = "MainReport"
    
                                report.Load(FullPathAppFolder + "Kupon.frx")
                                report.FileName = "Kupon"
                                report.RegisterData(dt, dt.TableName)
                                report.Prepare()
                                report.ShowPrepared()
                                report.Print()  'DIRECT TO PRINTER
                            End Using
                        End Using
                    End Using
                End Using
    

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.