Hi All,
I have a small question about a list box.
On one of my forms I have a list box. One of the column fields, which is the bound column table ID) has a reference to the forms table ID, This is so the info in the list box is relevant to the forms records. I'll be using the list box as a filter for the forms records basically.
I'm trying to find a way so that the last item is selected automatically and not the first. I've tried a couple of things including:
OnLoad Event:
If I use only the .setfocus and type, for example, .ListIndex = 1, then it will go will set focus on item index 1. If I use the lngCount variable which counts how many items there are, I get a 7777 error, improper use of this function.
All I want to do is to write code that will automatically select the last item in the list box when the form opens.
Does anyone know how to do this?
Thanks
I have a small question about a list box.
On one of my forms I have a list box. One of the column fields, which is the bound column table ID) has a reference to the forms table ID, This is so the info in the list box is relevant to the forms records. I'll be using the list box as a filter for the forms records basically.
I'm trying to find a way so that the last item is selected automatically and not the first. I've tried a couple of things including:
OnLoad Event:
Code:
lngCount = Me.lstRateOfPay.ListCount
Me.lstRateOfPay.SetFocus
Me.lstRateOfPay.ListIndex = lngCount
If I use only the .setfocus and type, for example, .ListIndex = 1, then it will go will set focus on item index 1. If I use the lngCount variable which counts how many items there are, I get a 7777 error, improper use of this function.
All I want to do is to write code that will automatically select the last item in the list box when the form opens.
Does anyone know how to do this?
Thanks