need to create dynamic reports in vb

need to create dynamic reports in vb

Page 1 of 1

1 Replies - 5200 Views - Last Post: 16 March 2008 - 08:10 AM Rate Topic: -----

#1 jayraj  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 16-February 07

need to create dynamic reports in vb

Post icon  Posted 16 March 2008 - 07:53 AM

hey guys can ne1 tell me how to create simple dynamic reports on the basis of clickin a item in the combo box and thn gettin a report table which shows d price and the total of all the items .
c the d code is worin fine all i need to do is connect it to a data report which is dynamic
that means the items selected in the combo box are displayed in the report as soon as the user presses the add button
the code is workin fine for d project as of now
but how do i generate dynamic reports
plz help guys

Private Sub Form_Load()
Set cn2 = New ADODB.Connection
Set rs2 = New ADODB.Recordset

Set cn3 = New ADODB.Connection
Set rs3 = New ADODB.Recordset

Set cn4 = New ADODB.Connection
Set rs4 = New ADODB.Recordset

cn3.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\smartbill.mdb"
rs3.Open "perscription", cn3, adOpenDynamic, adLockOptimistic, adCmdTable


'------------------------  this is for the Report table
Set cn8 = New ADODB.Connection
Set rs8 = New ADODB.Recordset

cn8.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\smartbill.mdb"
rs8.Open "report", cn8, adOpenDynamic, adLockOptimistic, adCmdTable

With rs8
If .BOF = True Then
txtbillno = 1
txtbillno = rs8.Fields("bill_no") + 1
End If
End With
'Call ViewRecord

'Call ViewRecord2
Call comboRecord1

'txtprice.Text = ""
'txttax.Text = ""
'txttotal.Text = ""
'txtproduct.Text = ""
'txtname.Text = ""
'txtqty.Text = ""

'This connects the fields to the report table..
End Sub

Private Sub Combo1_click()
 Call setCombo
 'Combo2.Enabled = False
 'Combo3.Enabled = False
End Sub

Private Sub Combo2_click()
 Call setCombo1
 'Combo1.Enabled = False
 'Combo3.Enabled = False 
End Sub

Private Sub Combo3_click()
 Call setCombo2
 'Combo2.Enabled = False
 'Combo1.Enabled = False 
End Sub

Private Sub txtqty1_Change()
txttotal1 = Val(txtqty1.Text) * Val(txtprice1.Text) + Val(txttax1)
End Sub
Public cn3 As New ADODB.Connection
Public rs3 As New ADODB.Recordset
Sub ViewRecord1()
With sales

If Not rs3.RecordCount = 0 Then
'.Text1 = ""
.txtprice1 = ""
.txttax1 = ""
.txtproduct1 = ""    
    If Not IsNull(rs3![uprice]) Then .txtprice1 = rs3![uprice]    
    If Not IsNull(rs3![tax]) Then .txttax1 = rs3![tax]    
    If Not IsNull(rs3![product]) Then .txtproduct1 = rs3![product]    
End If

the module code for d form 

End With
End Sub

Sub setCombo1()
    rs3.Find "product='" & sales.Combo2.Text & "'"    
End Sub

Sub comboRecord1()
With sales

If rs3.BOF Or rs3.BOF Then
     End If
Do Until rs3.EOF
         .Combo2.AddItem "" & rs3.Fields("product")
       ' rs.Close -----> if data from separet table               
End With
End Sub

Please use code tags when posting your code :code:

This post has been edited by jayraj: 16 March 2008 - 01:35 PM

Is This A Good Question/Topic? 0
  • +

Replies To: need to create dynamic reports in vb

#2 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1659
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: need to create dynamic reports in vb

Posted 16 March 2008 - 08:10 AM

Well you've provided us with your code, but haven't said what isn't working, if you're getting any errors, anything vital we need to help you. Are you receiving any errors? Does this code not work that way you intended it? When asking for help there are a couple items that are vital in order for someone to properly help you:

  • Post the code you're having problems with (done)
  • Post the exact error you're receiving, if you are receiving one
  • If no error explain what the code is doing versus what you want it to do

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1