PDA

Click to See Complete Forum and Search --> : Can't get DataCombo to work


JasonS
Sep 23rd, 1999, 01:29 AM
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.

VorTechS
Sep 23rd, 1999, 09:53 PM
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?

JasonS
Sep 23rd, 1999, 10:31 PM
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.