Results 1 to 3 of 3

Thread: Can't get DataCombo to work

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 1999
    Location
    Ohio
    Posts
    59

    Post

    I have a form that contains a text box and a DataCombo. I can't get the combo box to update the destination table. I'm trying to display a series of questions and the responses that the user can select.
    Here's the details:
    ADO source1: I have 2 tables that are joined by a SQL statement that displays the question from the Question table in the text box and it also selects the myResponse field(where I want the combo box results) from the company table.
    ADO source2: The responses that populate the combo box comes from the Responses table. The response table has a display field(which shows in the combo) and a response field which is just a number(ie:1-5) which is what I want to write the the "myResponse" field in ADO source1.
    Each question can have multiple responses and the question and responses have a common ID.
    For example Question 1 has an id of 100 and in the responses table there are 5 rows with the ID of 100.

    1. Am I going about this the correct way?
    2. Is there an easier way to do what I want?
    Thanks in advance.

  2. #2
    Lively Member
    Join Date
    Jan 1999
    Location
    Gloucester, UK
    Posts
    78

    Post

    This looks familiar, and I thought I replied to it or maybe it was something similar...

    Anyway, the trick is to use Combo1 to reset the SQL source of your 2nd ADO control. Now I'm not sure on how ADO works, as it's something I have yet to play with...however here's a simple data control example (which assumes you already have set the database name/connection)

    combo1_click()

    if val(combo1) > 0 then
    data1.recordsource = "SELECT * FROM myTable WHERE ID = " & val(combo1)"
    data1.refresh
    endif
    end sub

    Does this help?

  3. #3

    Thread Starter
    Member
    Join Date
    Aug 1999
    Location
    Ohio
    Posts
    59

    Post

    I can get the combobox to refresh with the correct data which is what I think your code is doing.
    For some reason when I select the data from the combo and then move to the next record the result is not saved in the database.

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