|
-
Nov 21st, 2000, 05:54 PM
#1
Thread Starter
New Member
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?
-
Nov 21st, 2000, 11:36 PM
#2
Lively Member
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
-
Nov 22nd, 2000, 04:23 AM
#3
Thread Starter
New Member
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?
-
Nov 22nd, 2000, 09:44 AM
#4
Addicted Member
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
-
Nov 22nd, 2000, 10:30 AM
#5
Addicted Member
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]
-
Nov 22nd, 2000, 04:43 PM
#6
Thread Starter
New Member
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?
-
Nov 22nd, 2000, 08:23 PM
#7
Addicted Member
not sure, that is the only way I was able to figure out how it worked, good luck!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|