How do I set the rowsource box of a listbox to empty

Question 1
I have a listbox that loads up with default values when my form loads and I want the listbox to be empty when the form loads until the user selects an value from the drop down box. How can I accomplish this ?

Question 2
Also how I have an autonumber field on my form and when the form is in form view autonumber is still displayed in the box until the user selects a new user. How do I remove autonumber from the textbox while the form is in form view ?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Q1 me.listbox.rowsource = null
Q2 hide the textbox:

me.textbox.visible = false
Question 2 - You could create an unbound text box and have it's control source your autonumber field.


change MyAutoNumber to your autonumber control name.

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Question 1 - Is the Listbox you are wanting to be empty base it's values off of the value the user selects from the drop down box?  If so, you can base the value of the list box using the drop box value as a criteria.  Then in the after update event of the drop down box requery the Listbox.

tupac1979Author Commented:
The 2nd solution but the 1st solution gives me a run time error of "Invalid use of Null Error 94"

the code looks like this:
Private Sub Form_Load()
   If IsNull(Me.cboemp1) Then
      Me.ClassList.RowSource = Null  - This is the line with the Run Time error
      Me.reqList.RowSource = Null
End If
End Sub
sorry try =""

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tupac1979Author Commented:
Thats correct thanks alot
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.