|
Answer» Dear Sir
I have used below coding to display specific record from the database. The problem is, when I click on command BUTTON, it is displaying only one record from the database. Though there are other records. I have tried a lot, please see my coding in below:
Dim rst As New ADODB.Recordset
Private Sub cmdshow_Click() frmpurchaseqty.Visible = False SSTab1.Visible = True DBconnect If rst.State = adStateOpen Then rst.Close rst.Open "tblpurchasesupplyqty", CNT, adOpenDynamic, adLockOptimistic If Not rst.EOF Then rst.MoveNext If cmbsupplier.Text = rst.Fields(5) And cmbitemref.Text = rst.Fields(6) And DTPicker1.Value = rst.Fields(3) Then With rst frmpurchaseqty.cmbitem.Text = .Fields(0) frmpurchaseqty.cmbbrand.Text = .Fields(1) frmpurchaseqty.cmbpurchaseqty.Text = .Fields(2) frmpurchaseqty.purchasedt.Value = .Fields(3) frmpurchaseqty.cmbpurchaseqty.Text = .Fields(4) frmpurchaseqty.cmbsuppliername.Text = .Fields(5) frmpurchaseqty.cmbitemrefno.Text = .Fields(6) frmpurchaseqty.cmbsupplierrefno.Text = .Fields(7) 'chkwarrenty.Value = .Fields( frmpurchaseqty.cmdwrrenty.Caption = .Fields( frmpurchaseqty.warrentyvoiddt.Value = .Fields(9) End With End If End Sub assuming you have successfully create the connection and rst object. to iterate the recordset, pseudocode as below:
Code: [Select]while not rst.eof msgbox rst.field(0) rst.movenext wendDear Sir
Thanks for your prompt response.
I have tried with your given code earlier but can't understand in which place I should place it.
Would you please let me know?
Regards PervezDear Sir
I have done it. Thanks for your NICE co-operation.
Regards talorababu
|