|
-
Jan 17th, 2002, 08:05 AM
#1
Thread Starter
Hyperactive Member
-
Jan 17th, 2002, 08:09 AM
#2
Hyperactive Member
Post the code, hard to tell the problem w/o it.
-
Jan 17th, 2002, 08:15 AM
#3
Thread Starter
Hyperactive Member
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
-
Jan 17th, 2002, 08:15 AM
#4
The way to avoid your infinite loop problem is to not simply update the combo box text automatically, but to check what is in it first to see if it is already correct. If the value is already the correct one (meaning that it has already been updated), then do not update the contents. This will prevent re-triggering the event that signals the update. If you could post the event subs, we could show you what needs to be done to them.
-
Jan 17th, 2002, 08:25 AM
#5
Thread Starter
Hyperactive Member
Excellent idea jdc2000
VB Code:
If(cboBatch.Text = .Fields("BatchNumber").Value)Then
Exit Sub
Else
cboBatch.Text = .Fields("BatchNumber").Value
End If
This should do it you think?
-
Jan 17th, 2002, 08:34 AM
#6
Hyperactive Member
cboBatch.Text = .Fields("BatchNumber").Value
won't this Just overwrite the FirstItem in the list so that
only the Last Item in your Record Set will be the only
Item in your ComboBox??
Maybe
cboBatch.Aditem(.Fields("BatchNumber").Value)
Instead??
-
Jan 17th, 2002, 08:39 AM
#7
Thread Starter
Hyperactive Member
No it only sets the text property.
The list is unaffected.
As the list in the other combo is created at the same time as this one, that is exactly what I want.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|