Hi,I am new to VB6 and doin a project on it.
1.)
I need to create a Listbox in a form1 which wil display data from
another table in DB(MS ACCESS).Whenever any changes occur in that table,it should get
reflected in the listbox.
Ex:We have a table containing country names like India,America,australia.
Now in form1, I need to show the above countries as a listbox.If I delete America
from the DB table,it should reflect on the listbox

2.)
a = "insert into ATM1 values (" & CInt(Trim(Text1.Text)) & ",'" & Text2.Text & "')"

Can anyone pl explain the above syntax.ie where and why & ' " occur

HI Karthic

To load items in the list box use the below code,
(i assumed Rs as your record set)...

rs.movefirst
For i=0 to rs.recordcount
     list1.additem=rs!Country
     rs.movenext
next

To delete an item from the database and reflect the change in List box,use the following code

Private Sub List1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyDelete Then
    rs.Delete "Select coutry from TableName where Coutry='" & List1.Text & "'"
list1.clear
rs.movefirst
For i=0 to rs.recordcount
     list1.additem=rs!Country
     rs.movenext
next
End If
End Sub

and about your secod question...

In the query string is recognized only when they placed between the ' and '

and the & symbol is concaternation operator, it concatenates the strings

I hope this will helpfull to you

With regards
Venkatramasamy SN

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.