Click to See Complete Forum and Search --> : DBCombo - SelectedItem
Watty
Sep 5th, 1999, 01:55 PM
DBCombo's click event has the following code:
Data1.Recordset.bookmark & _
= dbcombo1.selecteditem
but it gives an error : Object doesn't support this property or method (Error 438)
please state why.
Serge
Sep 6th, 1999, 04:21 PM
It happens because you have DataCombo bounded to a specific field of your data control. It means that it shows only one record at a time. I usually use regular combo box to do the navigation. In a example below I'm using Northwind database that comes with VB, so the field I'm using is CompanyName.
Put this code on Form_Activate event:
Do Until Data1.Recordset.EOF
Combo1.AddItem Data1.Recordset.Fields(1)
Data1.Recordset.MoveNext
Loop
Data1.Recordset.MoveFirst
Combo1.ListIndex = 0
Then put this line on Combo1_Click event:
Data1.Recordset.FindFirst "[CompanyName]='" & Combo1.List(Combo1.ListIndex) & "'"
Hope this helps.
Regards,
------------------
Serge
Software Developer
Serge_Dymkov@vertexinc.com
Access8484@aol.com
Ludmila
Sep 6th, 1999, 06:18 PM
Please, check how dbcombo is connected to Data control. I used RowSourse = Data1 and ListField = some field in the recordset.
I used this procedure:
Private Sub DBCombo1_Click(Area As Integer)
Data1.Recordset.Bookmark _
= DBCombo1.SelectedItem
End Sub
And it works perfect.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.