Results 1 to 3 of 3

Thread: Run-Time bindings - nightmare

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Posts
    195

    Question Run-Time bindings - nightmare

    Hello vb-world fans !

    I am moving slowly through ADO and I ran to a problem I already had once but @ that time I didn't care about it and did a workaround. But now I want to solve it. Soooo ....

    I have a combo -> User selects a record -> BoundText returns ID and I want to display the respective records in another combo. Doesn't look hard, does it? /Let's use a simple example: In one combo you have all surnames and when you select for example Moore it will populate the other combo with Karl, Peter, Josh etc./

    I have created a command that selects the records from the table and I thought that when I just add the WHERE clause to the commandtext at run-time it will work. But oh ah ...
    When I set the command text to the new value "SELECT ... WHERE ..." nothing happens and combo stays empty. Even after changing the commandtext I rebind the combo -> no change.

    So ... looks simple to me but I can't figure it out.
    Anybody?
    TIA.
    Brandon

  2. #2
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    could u show the code where u have trouble?
    -= a peet post =-

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Posts
    195
    Sure but before I do that it might be more simple if you could just give me a "walkthrough"

    Maybe I am doing something wrong. I am using ADO ComboBox which I have binded to DataEnvironment and One of its commands in design time. This Combo works fine. Then I have another combo which is being binded @ run-time. However I am just guessing here how to bind it.

    Ok, here is the code:
    PEOPLE_LEFT and PEOPLE_RIGHT are constatnts that define the SQL ("SELECT Sn+','+Fn AS FullName FROM Names WHERE OrID=.... ORDER BY FullName")
    VB Code:
    1. If dbcboOrg.MatchedWithList Then
    2.         Set newCOM = New ADODB.Command
    3.                 newCOM.CommandText = _
    4.             PEOPLE_LEFT & _
    5.             dbcboOrg.BoundText & ")" _
    6.             & PEOPLE_RIGHT
    7.         Set newCOM.ActiveConnection = deZakLis.cnDBZakLis
    8.         newCOM.CommandType = adCmdTable
    9.         newCOM.Prepared = True
    10.         dbcboLudia.RowMember = newCOM.Name
    11.         dbcboLudia.ListField = "FullName"
    12.         dbcboLudia.ReFill
    13.         dbcboLudia.Visible = True
    14.         dbcboLudia.SetFocus
    15.         ....

    Hope it is clear. Before using newCOM I tried using a command that was created in the DataEnvironment but when I changed it's commandtext it showed no results.
    Brandon

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