Select All Records

  • Thread starter Thread starter Martin
  • Start date Start date
M

Martin

Hi,

I have a list box that when the form opens it will go to that list box and
select all the records in it. I can get to the control but cant think how to
select all the records.

Can anyone help? Here is the on line of code:

DoCmd.GoToControl "MyList"

I thought it might be something like:

DoCmd.GoToControl "MyList"
DoCmd.GoToRecord, SelectAll (?)
or
Me.MyList.itemdata(0,9999) or something like that?

Thanks for your help in advance.

M
 
Martin said:
Hi,

I have a list box that when the form opens it will go to that list box and
select all the records in it. I can get to the control but cant think how
to
select all the records.

Can anyone help? Here is the on line of code:

DoCmd.GoToControl "MyList"

I thought it might be something like:

DoCmd.GoToControl "MyList"
DoCmd.GoToRecord, SelectAll (?)
or
Me.MyList.itemdata(0,9999) or something like that?

Thanks for your help in advance.

M

You need something like this:

http://www.smccall.demon.co.uk/Forms.htm#SelectAll

Easy to use. Say your listbox is called MyList, to select all items:

SelectAll MyList

and to de-select all:

UnSelectAll MyList
 
Back
Top