Can someone please help with my List Box problem

  • Thread starter Thread starter Buddy
  • Start date Start date
B

Buddy

others have tried and I have failed (partially because I'm not that bright)

I have a list box within a form. The form when opened will automatically go
to a new record, my problem is that when the form opens to a new record the
List Box has already highlighted (selected) an entry from my very first
record. How can I make it reset?

Remember that I'm not the sharpest tool in the shed when you try and
explain.

Thanks to anyone that can help out.
 
Buddy said:
others have tried and I have failed (partially because I'm not that bright)

I have a list box within a form. The form when opened will automatically go
to a new record, my problem is that when the form opens to a new record the
List Box has already highlighted (selected) an entry from my very first
record. How can I make it reset?

Remember that I'm not the sharpest tool in the shed when you try and
explain.

From the Open event of the form, set the Value property of your ListBox
to Null

* open the form in Design view
* display the property sheet, tab Events
* at onOpen, select [Event Procedure] if it isn't already there
* click the three dot button
* in the VBA location you arrive, type

yourListbox = Null

replacing yourListbox with the name of the listbox control (not sure?
select it, and check the Other tab of the property sheet for the Name
property)
 
I have one small problem, I have a maco set up to run in place of an event
procedure in the field 'onOpen'. The macro is a simple one that just opens
a new record, can I run the macro from an event procedure?

Bas Cost Budde said:
Buddy said:
others have tried and I have failed (partially because I'm not that bright)

I have a list box within a form. The form when opened will automatically go
to a new record, my problem is that when the form opens to a new record the
List Box has already highlighted (selected) an entry from my very first
record. How can I make it reset?

Remember that I'm not the sharpest tool in the shed when you try and
explain.

From the Open event of the form, set the Value property of your ListBox
to Null

* open the form in Design view
* display the property sheet, tab Events
* at onOpen, select [Event Procedure] if it isn't already there
* click the three dot button
* in the VBA location you arrive, type

yourListbox = Null

replacing yourListbox with the name of the listbox control (not sure?
select it, and check the Other tab of the property sheet for the Name
property)
 
Buddy said:
I have one small problem, I have a maco set up to run in place of an event
procedure in the field 'onOpen'. The macro is a simple one that just opens
a new record, can I run the macro from an event procedure?

Yes, but never mind that. Every macro action has its VBA pendant.

To go to a new record from VBA (nice exercise for in the Help if you use
A97, A2Ks help is rather unreliable):

docmd.gotorecord,,acnewrec
 
Wonderful...except...

a new record does come up and is not selecting anything in my listbox, but
(my list box is just tall enough to show one available selection, you have 5
total available selections to choose from) my listbox shows (not selected)
the first selection of my first record. How can I make my listbox totally
reset and show the first selection that is available?

thanks again for the help and education.
 
Hi
This may sound as a very stupid solution but to make all selections to be deselected, just select an item and deselect it when the form opens
use the listbox.selected(i)=true and listbox.selected(i)=false statments

after this is executed,the listbox will display all items without any of them being selected
 
sorry, i don't follow...
am i to type
listbox.selected(option1)=true
listbox.selected(option1)=false
in my event procedure that is set up to run on form open?

Bharath said:
Hi,
This may sound as a very stupid solution but to make all selections to be
deselected, just select an item and deselect it when the form opens.
 
Back
Top