I have a combo box, EventCombo, on a form.
The row source is "All events that haven't been 'put-to-bed'".
DCount works out how many rows there will be in the combo box.
The following code works a treat (not rocket science, anyway), apart from the action to be taken if dc = 1
I can't seem to program the line of code needed to replace the comment
' display the only row, so user doesn't need to pull down the list
My first thought was to write ...
Me.EventCombo.S elected(1) = True
... expecting this to display data from the first and only row in the list.
It didn't! All it did set the focus to the combo box (put the cursor in there).
Much further pointless messing about produced no solution.
Any ideas?
The row source is "All events that haven't been 'put-to-bed'".
DCount works out how many rows there will be in the combo box.
The following code works a treat (not rocket science, anyway), apart from the action to be taken if dc = 1
Code:
Dim dc As Integer
dc = DCount("EventPutToBed", "EVENT", "EventPutToBed = False")
If dc = 1 Then
' display the only row, so user doesn't need to pull down the list
Else
If dc = 0 Then
MsgBox ("You need to set up an Event record first.")
Exit Sub
Else
' user will choose the relevant event from the list
End If
End If
' display the only row, so user doesn't need to pull down the list
My first thought was to write ...
Me.EventCombo.S elected(1) = True
... expecting this to display data from the first and only row in the list.
It didn't! All it did set the focus to the combo box (put the cursor in there).
Much further pointless messing about produced no solution.
Any ideas?
Comment