fritterdog
Technical User
I'm struggling with a problem I originally posted on the forms discussion board (thread702-613570 provides details) but now I am writing vb code...
Essentially I want to use data from Table A, field 1 that is in a combo box X to do a query in Table A to return Table A field 2 that is then used to populate text box Y that corresponds to Table B, field 1.
I think the best way to do this is to have the update event for combo box X run the query and somehow get the value I want to stick in box Y. The problem is I cant figure out how to do this. I want something like
private sub box_X_change
box_Y.value = doCmd.runSql "select A.field_2 from A where A.field_1==box_X.value"
end sub
Essentially I want to use data from Table A, field 1 that is in a combo box X to do a query in Table A to return Table A field 2 that is then used to populate text box Y that corresponds to Table B, field 1.
I think the best way to do this is to have the update event for combo box X run the query and somehow get the value I want to stick in box Y. The problem is I cant figure out how to do this. I want something like
private sub box_X_change
box_Y.value = doCmd.runSql "select A.field_2 from A where A.field_1==box_X.value"
end sub