Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vbmodal report

Status
Not open for further replies.

nnmmss

Programmer
Sep 7, 2004
123
0
0
IR
how can i open a report or form which is in activex dll file ( which i use it like com object) ( as i have explained in report interface in dll file Thread) as vbmodal.i have done this

this is coded in Main project which produce exe file
Set ObjRptTemp = CreateObject("PrjReport.clsReport")
Call ObjRptTemp.ShowForm()
Set ObjRptTemp = Nothing

and this is in PrjReport ( Activex Dll Project )
Public Sub ShowForm()
TempRptCurPV.Show vbModal
End Sub

but TempRptCurPV would not be open as vbmodal, i can switch to the previous form.
 
It's been a while since I messed with calling reports in that fashion. But, if memory serves the problem is because you are creating the object first, then trying to set the vbModal attribute. I vaguely remember that you have to set the vbModal at time of creation.

If I'm completely off-base with this, please someone speak up :)
 
In my project, I do something very similar, but I've enhanced it some. My app has about 120 reports, so I've broken them up in to categories. I have about 20 report dll's. Each report has it's own class module, with a single function in it, called PrintReport. The Print Report subroutine accepts 1 parameter for the database connection string. When my executable starts, it scans the files in the bin folder and registers the dll's. It then examines the dll's to see if it's a report dll (each report dll has a ReportConfig class that specifies the menu location). If it's a report dll, it adds the report to the menu bar.

The beauty of this method is that I can create additional reports for my application. My customers can download the dll in to the bin folder and re-start the application, which will add the report to the menu.

In the class module for the DLL...
Code:
Public Sub PrintReport(ByVal ConnectionString As String)

    Dim bCancel As Boolean
    Dim cSchoolList As String

    globalConnectionString = ConnectionString
    
    Call frmSelectSchools.GetSchools("School Calendar", cSchoolList, bCancel)
    If bCancel Then
        Exit Sub
    End If
    
    Call ShowReport(cSchoolList)

In the selection form...
Code:
Public Sub GetSchools(ByVal Caption As String, ByRef SchoolList As String, ByRef Cancel As Boolean)
    
    Me.Caption = Caption
    bCancel = True
    Call PopulateSchoolList
    Call Show(vbModal)
    SchoolList = cSchoolList
    Cancel = bCancel
    
End Sub


-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
well gmmastros seems great, but i have some question about your method.

1- where do you say that report should be appeared as vbmodal. do u show the report Interface in Call ShowReport(cSchoolList)? what is Call Show(vbModal)?

2- how do u understand that a dll has a "ReportConfig class"?

3- you said "When my executable starts, it scans the files in the bin folder and registers the dll's." so when the executable should be unloaded do u unregister the dll ? or you just always register New Dll?

thank you for your very beautiful method and answer also
 
Actually i couln't open a report VBModal in a Dll from a menu in executable project. any clue for that?
 
The form that is contained within the report dll has a public subroutine with byref parameters. This subroutine is called from the class module in the dll. This subroutine has Call Show(vbModal) in it. So, effectively, the form is causing itself to show.

Generally, the flow is...

Executable:
Create an instance of the dll and call the PrintReport subroutine.

DLL ClassModule:
Save the database connection string to a global variable.
Get the report selections (from a form in the dll)
Print the report

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top