Can anybody tell me how should i generate automatic sr no which match with mr no. i have written a code but it is not working properly.

Dim crystal As CRAXDDRT.Application
Dim Report As CRAXDDRT.Report
Dim cparam As CRAXDRT.ParameterFieldDefinition
Dim cparams As CRAXDDRT.ParameterFieldDefinitions
Dim con As ADODB.Connection
Dim rs As ADODB.Recordset

Private Sub Form_Load()
Call loadreport
Screen.MousePointer = vbHourglass
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
End Sub

Private Sub Form_Resize()
CRViewer1.Top = 0
CRViewer1.Left = 0
CRViewer1.Zoom 100
CRViewer1.Height = ScaleHeight
CRViewer1.Width = ScaleWidth
End Sub
Private Sub loadreport()
    Set con = New Connection
    con.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=\\asfserver\itp$\Product_tabletest.mdb")
   'DataPath = "\\asfserver\itp$\Product_tabletest.mdb"
    Set rs = New ADODB.Recordset
    Set crystal = New CRAXDDRT.Application
    Set Report = New CRAXDDRT.Report
    rs.Open "select * from mr", con, adOpenDynamic, adLockOptimistic
    Set Report = crystal.OpenReport(App.Path & "\" & "list2.rpt", 0)
 End Sub

What?

What?

sir i want if sr no should come on the basis of records. if there
are four records having requisition no same . then these records
should come with sr no .

sr no         productname                 quantity       req_no
1               rota cutter 10 dia               30            10
2              rota cutter  20 dia              50             10
3             rota cutter 50 dia                60             10

Hi,

Open Report In CR Designer, Goto menu :
Insert >> Special Field >> Record Number Field
and then Save the report

REgards
Veena

jan18.doc

when i placed record no from special field it will only print record no
suppose there is a condition(((MR.Req_no)=" & Text12.Text & "));" suppose in text12=121.obviously it will return those records whichv match this condition having req no 121 .i want if there are 10 recordshaving req no 121 then it should generate sr no on that condition.kindly see the attachment please for detail.

Dim crystal As CRAXDDRT.Application
Dim Report As CRAXDDRT.Report
Dim cparam As CRAXDDRT.ParameterFieldDefinition
Dim cparams As CRAXDDRT.ParameterFieldDefinitions
Dim con As ADODB.Connection
Dim rs As ADODB.Recordset
End Sub

Private Sub Form_Load()
Call loadreport
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
End Sub

Private Sub Form_Resize()
CRViewer1.Top = 0
CRViewer1.Left = 0
CRViewer1.Zoom 100
CRViewer1.Height = ScaleHeight
CRViewer1.Width = ScaleWidth
End Sub
Private Sub loadreport()
Set con = New Connection
con.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=\asfserver\itp$\Product_tabletest.mdb")
Set rs = New ADODB.Recordset
Set crystal = New CRAXDDRT.Application
Set Report = New CRAXDDRT.Report
rs.Open "select * from MR", con, adOpenDynamic, adLockOptimistic
Set Report = crystal.OpenReport(App.Path & "\" & "list2.rpt", 0)
End Sub

Hi,

So where are you passing the recordselection formula...?

madem i didn't pass report selection formula can you explain i don't know .
PO.zip

Madem simple have place a command button crystal report in a mr form then in the click event i have writen Form6.Show vbModeless
and finally form6 i .e under crviewer .i have written a code.

Dim crystal As CRAXDDRT.Application
Dim Report As CRAXDDRT.Report
Dim cparam As CRAXDDRT.ParameterFieldDefinition
Dim cparams As CRAXDDRT.ParameterFieldDefinitions
Dim con As ADODB.Connection
Dim rs As ADODB.Recordset

Private Sub Form_Load()
Call loadreport
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
End Sub

Private Sub Form_Resize()
CRViewer1.Top = 0
CRViewer1.Left = 0
CRViewer1.Zoom 100
CRViewer1.Height = ScaleHeight
CRViewer1.Width = ScaleWidth
End Sub
Private Sub loadreport()
Set con = New Connection
con.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=\asfserver\itp$\Product_tabletest.mdb")
Set rs = New ADODB.Recordset
Set crystal = New CRAXDDRT.Application
Set Report = New CRAXDDRT.Report
rs.Open "select * from MR", con, adOpenDynamic, adLockOptimistic
Set Report = crystal.OpenReport(App.Path & "\" & "list2.rpt", 0)
End Sub

i got error when i tried to pass recordselection formula .
run time error -2147191859.

dim crystal As CRAXDDRT.Application
Dim Report As CRAXDDRT.Report
Dim cparam As CRAXDDRT.ParameterFieldDefinition
Dim cparams As CRAXDDRT.ParameterFieldDefinitions
Dim con As ADODB.Connection
Dim rs As ADODB.Recordset
Dim recordsql As String

Private Sub Form_Load()
Call loadreport
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
End Sub

Private Sub Form_Resize()
CRViewer1.Top = 0
CRViewer1.Left = 0
CRViewer1.Zoom 100
CRViewer1.Height = ScaleHeight
CRViewer1.Width = ScaleWidth
End Sub
Private Sub loadreport()
    Set con = New Connection
    con.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=\\asfserver\itp$\Product_tabletest.mdb")
    Set rs = New ADODB.Recordset
    Set crystal = New CRAXDDRT.Application
    Set Report = New CRAXDDRT.Report
    [B]recordsql = "SELECT * From MR WHERE (((MR.Req_no)=" & [/B]MR.Text12 & "));"
    [B]rs.Open recordsql, con, adOpenDynamic, adLockOptimistic[/B]
    MsgBox (MR.Text12)
    Set Report = crystal.OpenReport(App.Path & "\" & "list2.rpt", 0)
    Report.RecordSelectionFormula = recordsql    End Sub
Be a part of the DaniWeb community

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