I have 3 combo boxes, which are all output to, from a For ... Next loop. Here's the code -
When I set a breakpoint at this loop, it loads all the relevant data properly, in the 3 named boxes. However, when let to run normally it only loads the first combo ( as if the code runs 'too quickly' to complete the task ?? Any suggestions.
Code:
For i = 0 To 2
Set rst = db.OpenRecordset("SELECT " & tbl(i) & fld(i) & " FROM " & tbl(i) & " INNER JOIN tblPersonalInfo ON " & tbl(i) & fld(i) & "_ID" & "= tblPersonalInfo" & fld(i) & "_ID" & " WHERE ((tblPersonalInfo.Client_ID)=" & Me.Recordset.Fields("Client_ID") & ");")
X = 0
rst.MoveLast
rst.MoveFirst
X = rst.RecordCount
If X > 0 Then
Select Case i
Case 0
Y = 1
Me.cboEthnicity.SetFocus
Me.cboEthnicity.Text = rst!Ethnicity
Case 1
Y = 1
Me.cboReligion.SetFocus
Me.cboReligion.Text = rst!Religion
Case 2
Y = 1
Me.cboSexuality.SetFocus
Me.cboSexuality.Text = rst!Sexuality
End Select
End If
rst.Close
Next i