im a beginner in vb. i really want some help in using vb. actually i want link my vb interface to data in access using adodb. then how to list data (access) through vb interface according to some criteria that had been set by user. Example:
using customer id: 102,103,104,105,106,107,108,109,120
list detail (name, address) of customer by using customer id from 103 to 108.
how about coding?

or anybody have suggestion website for me to review...
i really need help....pls

8 Years
Discussion Span
Last Post by arayaaa


Try the below coding:

'Declare the Variables for Connection and RecordsetDim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset

Private Sub Form_Load()
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
'Open the Connection
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\shailaja\pract\testing.mdb;Persist Security Info=False"

'Open the Recordset
rs.Open "select * from customer", cn, adOpenDynamic, adLockOptimistic

'To Search Particular Customer Id bind all customer id to the Combo Box
While Not rs.EOF
        Combo1.AddItem rs(0) 'Customer Id

End Sub

Private Sub Command1_Click()
Set rs = New ADODB.Recordset

'Open the Recordset to get particular Customer Detailrs.Open "select * from customer where customer_id = '" & Combo1.Text & "'", cn, adOpenDynamic, adLockOptimistic


'Open the Recordset to get No. of Customer within the rangers.Open "select * from customer where customer_id >= '" & TxtFromCustId.Text & "' and customer_id <= '" & TxtToCustId.Text & "'", cn, adOpenDynamic, adLockOptimistic

End Sub

Shailaja M :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.