PDA

Click to See Complete Forum and Search --> : DBCOMBO SELECTION


EC68
Nov 21st, 2000, 04:54 PM
I WANT TO SELECT FROM A DBCOMBO BOX A RECORD
AND DELETE THIS RECORD FROM MY DATABASE
I TRIED
DATA1.RECORDSET.BOOKMARK=DBCOMBO1.SELECTEDITEM
BUT NOTHING
IT SHOWS AN ERROR
OBJECT DOESNT SUPPORT THE PROPERTY
I WANT TO USE THIS PROPERTY NOT AN SQL STATEMENT
WHY IT HAS IT IF IT DOESNT SUPPORT IT
SOMETHING I DO WRONG
ANY IDEAS?

makai
Nov 21st, 2000, 10:36 PM
a bookmark is generally a hidden value that will return you to a certain record in a recordset

you would have to declare a variable to hold the value of the bookmark that you want to save like:

Dim bk1
bk1 = Data1.Recordset.Bookmark


and then when you want to go to that record:
Data1.Recordset.Bookmark = bk1

these values are generaly not displayed in comboboxes

You may also have the problem that as you choose different field values in a combobox you are changing the recordset probably by changing the value of the defining recordsource in an SQL statement - If this is done then there is no comparable record in the new recordset that equals the bookmark you have saved



see help for Bookmark

EC68
Nov 22nd, 2000, 03:23 AM
but the selecteditem property of dbcombo returns
the bookmark of the position i click with the mouse
that is what the msdn writes for the selected item
why doesn t work with data1.recordset.bookmark?

mpSmooth
Nov 22nd, 2000, 08:44 AM
Hey there, I have an example at my work on what you are looking for in your combo box. I'll post an example when I get there.

Cheers

mpSmooth
Nov 22nd, 2000, 09:30 AM
In my example, I used the datalist control, not the
DBCombo. I also used the adodc control, not the standard datacontrol You may want to try using this one instead.

---Select Microsoft DataList Controls from components
---Bound the controls like before
---For the datalist, do not set the datacontrol or datfield property, only set the rowsource, listfields, and the boundcolumn
---In the datalist_Click even, add adodc1.recordset.bookmark = datalist1.selecteditem

Also, for example, if you list box is holding say, Customer Addresses, put a text box on the form, set the data fields to address and make it invisible. In the form load event,
set: DataList1.Text = txtAddress.Text, this will allow for the column to be highlighted in the list box. Give it a try..

[Edited by mpSmooth on 11-22-2000 at 11:35 AM]

EC68
Nov 22nd, 2000, 03:43 PM
IT WORKS
AND AS I SEE ALL THE MATTER IS NOT TO SET
THE DATAFIELD PROPERTY
WHEN YOU SET IT YOU SEE AGAIN THE MESAGE THAT OBJECT DOESNT SUPPORT THE PROPERTY
WHEN YOU LEAVE THIS EMPTY
ITS ALLRIGHT
WHY THIS HAPPENS?

mpSmooth
Nov 22nd, 2000, 07:23 PM
not sure, that is the only way I was able to figure out how it worked, good luck!