Help! Question on update List box

Help! Question on update List box

Post by Luch » Thu, 17 Jul 2003 10:11:18


I am learning VB and have question on a scenario describe
below:

Dim WithEvents adoDataList As Recordset

Sub Form_load
....
' read data and fill the form
adoDataList.open 'select .... ', connect, ....
End Sub

Sub Add_Click()
List.AddItem ("data 1")
List.AddItem ("data 2")
List.DataChanged = True <-- I can see data1 and
data2 been add to the
list. I also use view
local see that
Me.List.DataChanged is
True
...
End Sub

Sub Update_Click()
...
for i =0 to Me.List.RecordCount -1 Then
MsgBox Me.List.itemData(i).text
Next <-- Me.List.RecordCount
Seems correct. But,
Me.List.ItemData(i).Text
is blank. Am I using
the wrong member?
End Sub

Also, how to check if the field entry is number or text?
Somehow, the VB wizard did not verify it, even the
behavior says 'causesValidation' and DataFormat says
number.

Thanks for answers any of the questions!
 
 
 

Help! Question on update List box

Post by West Hi » Tue, 22 Jul 2003 16:08:41

I hope I understand you correctly, but to your first
question.

You were saying that text is blank, you may need to move
the recordset. Another word, in your for statement, put a
rst.movenext. As for your second question on how to check
for number of letter when key is press. You need to use
the keypress event for this.

Hope this helps.

West,
Me.List.RecordCount
(i).Text