How do I select first item in the listbox

  • Thread starter Thread starter SF
  • Start date Start date
S

SF

Hi,

I have a from having on listbox. I want to set default value in the listbox
to select the first item automatically. How do I do that?

SF
 
Try:
=[MyListBox].[ItemData](0)

You may need item 1 if the list box's Column Headings property is Yes.
 
Thank you for your prompt response. It work!!!.

SF


Allen Browne said:
Try:
=[MyListBox].[ItemData](0)

You may need item 1 if the list box's Column Headings property is Yes.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

SF said:
I have a from having on listbox. I want to set default value in the
listbox to select the first item automatically. How do I do that?
 
Hi Allen,
I want to set my default as the first item in my list box and I'm using the
code you mentioned below but how do I have my form open to that selection? I
have it going to the first item in the listbox but the form is defaulting to
the first record. How do I set the form to go to the record that is tied to
the first item in my listbox?

Allen Browne said:
Try:
=[MyListBox].[ItemData](0)

You may need item 1 if the list box's Column Headings property is Yes.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

SF said:
I have a from having on listbox. I want to set default value in the
listbox to select the first item automatically. How do I do that?
 
You will need to find that record in the RecordsetClone of the form in order
to navigate to it.

The find code will be similar to the code in this article:
Using a Combo Box to Find Records
at:
http://allenbrowne.com/ser-03.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

message
Hi Allen,
I want to set my default as the first item in my list box and I'm using
the
code you mentioned below but how do I have my form open to that selection?
I
have it going to the first item in the listbox but the form is defaulting
to
the first record. How do I set the form to go to the record that is tied
to
the first item in my listbox?

Allen Browne said:
Try:
=[MyListBox].[ItemData](0)

You may need item 1 if the list box's Column Headings property is Yes.

SF said:
I have a from having on listbox. I want to set default value in the
listbox to select the first item automatically. How do I do that?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top