Results 1 to 7 of 7

Thread: DBCOMBO SELECTION

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2000
    Posts
    3

    Angry

    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?

  2. #2
    Lively Member
    Join Date
    Aug 2000
    Posts
    125
    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


  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2000
    Posts
    3
    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?

  4. #4
    Addicted Member
    Join Date
    Nov 2000
    Posts
    217
    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

  5. #5
    Addicted Member
    Join Date
    Nov 2000
    Posts
    217
    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]

  6. #6

    Thread Starter
    New Member
    Join Date
    Nov 2000
    Posts
    3
    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?

  7. #7
    Addicted Member
    Join Date
    Nov 2000
    Posts
    217
    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
  •  



Click Here to Expand Forum to Full Width