OK this code uses BatchNumber and ReplicateNumber instead of leg and description, but the ideas the same.
As you can see I disable the other combo so things work, but I want the users to be able to switch between selection methods. So how can I make this work and leave the other enabled.
VB Code:
Private Sub cboRep_Click() cboBatch.Enabled = False If (Not (cboRep.Text = "")) Then cnnCon.Open dataText rsRes.Open "SELECT DISTINCT BatchNumber " & _ "FROM tblShadeDetails " & _ "WHERE ProjectTitle = " & Chr(34) & _ cboProject.Text & Chr(34) & _ " AND ExperimentID = " & Chr(34) & _ cboExperiment.Text & Chr(34) & _ " AND LegNumber = " & Val(cboLeg.Text) & _ " AND ReplicateNumber = " & Chr(34) & _ cboRep.Text & Chr(34), _ cnnCon, _ adOpenKeyset, _ adLockReadOnly, _ adCmdText With rsRes If (Not (.BOF And .EOF)) Then .MoveFirst While (Not .EOF) cboBatch.Text = .Fields("BatchNumber").Value .MoveNext Wend End If End With rsRes.Close cnnCon.Close End If setWashCycles End Sub




Reply With Quote