Full Version: List Box Question...
UtterAccess Forums > Microsoft® Access > Access Forms
lukesb
Hi Everyone...
I have a list box, a text box & a button on a form. The user can enter their own info in the textbox, or press the button to copy the selection from the listbox...
The problem is, if they click the button to copy from the listbox, it comes up as null. They have to select the list first, then click the button...
How can I have the list box select the first item in it when the form loads so that if the user wants to copy, they just have to click the button..?
Thanks
Luke
theDBguy
Can you show us the code for the button? You might just have to add a code to select the listbox first.
Alan_G
Hi
If you really wanted to select the first item in the list, then you could use the On Load event of the form..........
CODE
If Me.[NameOfListBox].ListCount > 0 Then
Me.[NameOfListBox].ListIndex = 0
End If

ODBG
Hope things are well for you sad.gif
RalphS
If i understand you, you will just want to say on form load:
istbox.Selected(0) = True
theDBguy
Hi Alan,
Thanks. All is well here. How is it across the pond?
Alan_G
>
Cold and wet laugh.gif
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.