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
Else
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.MoveFirst
rs3.Find "product='" & sales.Combo2.Text & "'"
ViewRecord1
End Sub
Sub comboRecord1()
With sales
.Combo2.Clear
If rs3.BOF Or rs3.BOF Then
Resume
End If
Do Until rs3.EOF
.Combo2.AddItem "" & rs3.Fields("product")
rs3.MoveNext
Loop
' rs.Close -----> if data from separet table
End With
End Sub
Please use code tags when posting your code
This post has been edited by jayraj: 16 March 2008 - 01:35 PM

New Topic/Question
Reply




MultiQuote



|