select the first row in a listbox as default

sampun

Registered User.
Local time
Today, 21:07
Joined
Mar 26, 2007
Messages
10
Hi all,

I tried to use =[listbox_name].itemdata(1) as the default value by setting it in properties of the listbox but it seems to throw up an error "The method you tried to invoke on an object failed"

Can anyone help please?

Ps - I tried itemdata(0) but i think that selects the header in the listbox so that's why I used 0.

Thanks
 
Sampun,

Need more info.

I don't think that you can set the first row as a default value for a ListBox, but
you can use some event to set:

Me.YourListBox.Selected(0) = True

hth,
Wayne
 
sam,

if your listbox is based on a field of a table you can set a default value by listing that value in the appropriate line at the bottom of the table design view.
 

Users who are viewing this thread

Back
Top Bottom