T
takatam
Hi,
I have a listbox which contains 1 column for which the values a
populated from a query. The query returns only 1 row hence my listbox
is basically a 1x1 matrix.
I would now like to use the value of this cell to change the
background color of the listbox. But for some reason I am not able to
find the right way to access this value.
I tried the following:
Private Sub List65_AfterUpdate()
If Me.List65.Value = 1 Then
Me.List65.BackColor = 255
Else
Me.List65.BackColor = 4259584
End If
End Sub
Should I maybe be using the .ItemData property? While I can get the
top row using .ItemData(0), this will still return the whole row and
so I'm not sure how to then get the first element out of that.
I also tried the property .Column(0,0) but without success.
The suspicious thing is that when I set a breakpoint on the first line
of the subroutine, the vba does not stop there, indicating that it is
actually not executed. Just to rule out problems of other origin,
here's the (automatic) code for my Refresh-button:
Private Sub ButtonRefresh_Click()
On Error GoTo Err_ButtonRefresh_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
Exit_ButtonRefresh_Click:
Exit Sub
Err_ButtonRefresh_Click:
MsgBox Err.Description
Resume Exit_ButtonRefresh_Click
End Sub
Any help is appreciated.
Thanks a lot,
T
I have a listbox which contains 1 column for which the values a
populated from a query. The query returns only 1 row hence my listbox
is basically a 1x1 matrix.
I would now like to use the value of this cell to change the
background color of the listbox. But for some reason I am not able to
find the right way to access this value.
I tried the following:
Private Sub List65_AfterUpdate()
If Me.List65.Value = 1 Then
Me.List65.BackColor = 255
Else
Me.List65.BackColor = 4259584
End If
End Sub
Should I maybe be using the .ItemData property? While I can get the
top row using .ItemData(0), this will still return the whole row and
so I'm not sure how to then get the first element out of that.
I also tried the property .Column(0,0) but without success.
The suspicious thing is that when I set a breakpoint on the first line
of the subroutine, the vba does not stop there, indicating that it is
actually not executed. Just to rule out problems of other origin,
here's the (automatic) code for my Refresh-button:
Private Sub ButtonRefresh_Click()
On Error GoTo Err_ButtonRefresh_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
Exit_ButtonRefresh_Click:
Exit Sub
Err_ButtonRefresh_Click:
MsgBox Err.Description
Resume Exit_ButtonRefresh_Click
End Sub
Any help is appreciated.
Thanks a lot,
T