Results 1 to 4 of 4

Thread: Strange problem with dbCombo.BoundText

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2000
    Posts
    50

    Question

    Here's a weird one that was driving me crazy today...

    I have a dbCombo bound to a data control (Data1) for a table that is just basically just an ID & Desc. The dbCombo.boundcolumn is set to the ID and the dbCombo.listfield is set to the Desc.
    In the Change event I do this:
    Data2.RecordSource = "select * from DifferentTable where ID_Field=" & dbCombo.BoundText
    Data2.Refresh

    Now, this works fine when I run the app from the IDE, but if I put a break point on the Data2.RecordSource line, the value of BoundText contains the value of the Desc field (which of course causes the line to fail). Strange...

    I am running VB6 SP4
    ~Michael Kizer
    http://Michael.Kizer.ws

    The Ivory Gate Of Dreams ~ http://www.ivorygate.com

  2. #2
    New Member
    Join Date
    Jun 2000
    Posts
    14

    Why the Change Event?

    I understand your binding to the Data Control "Data1", that is the ordinary thing. However what do you try to do with the Change event and the Data2?
    I would guess the reason why you did not get a reply earlier is that nobody understood what you actually want to do. Do you want to reload the same combo box from a different source, when the user has done a first selection?

  3. #3

    Thread Starter
    Member
    Join Date
    Apr 2000
    Posts
    50
    I can elaborate...
    the dbCombo in question is populated by Data1. Once the user chooses an item in that combo, I use that selection as the where clause argument for the select statement in Data2's RecordSource. I then use Data2 to populate a grid. THe user could at anytime go back up to the original dbCombo and change their selection, hence using the Change event.
    Hope that makes it a bit clearer.
    ~Michael Kizer
    http://Michael.Kizer.ws

    The Ivory Gate Of Dreams ~ http://www.ivorygate.com

  4. #4
    New Member
    Join Date
    Jun 2000
    Posts
    14
    In that situation I use the following:
    Data1.Recordset.Move dbCombo.SelectedItem - 1, 1
    strSQL = "SELECT ... : _
    & "WHERE ...=" & Data1.Recordset!ID
    Data2.Recordsource = strSQL
    Data2.Refresh
    It is not elegant at all and I suppose there should be better, but at least it works. Please criticise me freely and thanks for your elaboration.

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