Marc
Marc

Reputation: 16512

Change control source only selected combo box in continous form

As you can see here, the user can chose a contract or a proposal

enter image description here

The reference control source is not the same if it's a proposal or a contract.

So in the after update of the type combo box type, I do this

Private Sub cbType_AfterUpdate()
    If ([ReferenceType] = "Proposal") Then
        cbReference.ControlSource = "[ProposalNo]"
        cbReference.RowSource = "SELECT ProposalNo FROM Proposals WHERE ProposalNo is not null"
    ElseIf ([ReferenceType] = "Contract") Then
        cbReference.ControlSource = "[ContractNo]"
        cbReference.RowSource = "SELECT ContractNo FROM Proposals WHERE ContractNo is not null"
    End If
End Sub

The problem is it change the control source for all rows.

Is there a way to change it only for the selected row?

Thank you

Upvotes: 2

Views: 1776

Answers (1)

Fionnuala
Fionnuala

Reputation: 91336

No, there is not. You can think of a continuous form as a single form that shows you other rows. Any action on an unbound control affects all the rows. There are work-arounds that may suit. For example, you can show a textbox for the Reference and a "Change reference" combo. This will avoid confusing users because the bound textbox will not update. You can set various properties of the change combo with conditional formatting to make it all prettier. Alternatively, you can use two subforms or a pop-up form to edit data.

Upvotes: 3

Related Questions