Private Sub Cmd_Print_Click()
'On Error GoTo Error_Handler
If newflag <> 0 Then
MsgBox "Inserting New Record Mode, Press EXIT Button To Return To Normal Mode", vbCritical, "Attention"
Exit Sub
End If
If RepNo.Text = "" Then Exit Sub
Dim Report As New rstoreinmaterial
Report.RecordSelectionFormula = "{DetailsStore_InOut_Material.RepNo}= " & Val(RepNo.Text) & " and {DetailsStore_InOut_Material.projectno} = '" & ProjectNo1 & "'"
Form1.CRViewer1.ReportSource = Report
Form1.Show 1
Set rs = Nothing
Exit Sub
MsgBox Err.Number & " : " & Err.Description
Resume Exit_Error_Handler
End Sub

how i can fix this error ???

Recommended Answers

All 6 Replies

It seems that you have declared the object but did not set it, the error is refereing to "Report"

Add the following...

Dim Report As New rstoreinmaterial

Set Report = New rstoreinmaterial ''This line is new...

Report.RecordSelectionFormula = "{DetailsStore_InOut_Material.RepNo}= " & Val(RepNo.Text) & " and {DetailsStore_InOut_Material.projectno} = '" & ProjectNo1 & "'"

its still give the same problem :( , i installed the Crystal report 10 but i didnt usage is there is a relation between them ??

I doubt if there is a relation because the naming looks like someone who wrote the class code themselves. There must be function in your classes with the name rsstoreinmaterial that will handle all events for "Report". You need to make sure that it is in your application.

i found the class but when i added to the project it gives me an error and the class text convert to an red color . is any reference can i add???

Line 2: Class {BD4B4E61-F7B8-11D0-964D-00A0C9273C2A} of control Blank_rReportbydate was not a loaded control class.
Line 0: The file D:\AICI\Reports\Blank Report\Blank_rReportbydate.Dsr could not be loaded.
this is the error i got ...

Have a look at THIS from google.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.