?
Solved

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

Posted on 2004-11-09
7
Medium Priority
?
313 Views
Last Modified: 2006-11-17
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 ?
0
Comment
Question by:tupac1979
  • 3
  • 2
  • 2
7 Comments
 
LVL 4

Expert Comment

by:dan_vella
ID: 12532843
Q1 me.listbox.rowsource = null
0
 
LVL 4

Expert Comment

by:dan_vella
ID: 12532858
Q2 hide the textbox:

me.textbox.visible = false
0
 
LVL 10

Expert Comment

by:LenaWood
ID: 12532889
Question 2 - You could create an unbound text box and have it's control source your autonumber field.

=[MyAutoNumber]

change MyAutoNumber to your autonumber control name.

Lena
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 10

Expert Comment

by:LenaWood
ID: 12532922
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.

Lena
0
 

Author Comment

by:tupac1979
ID: 12533009
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
0
 
LVL 4

Accepted Solution

by:
dan_vella earned 500 total points
ID: 12533127
sorry try =""
0
 

Author Comment

by:tupac1979
ID: 12533149
Thats correct thanks alot
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question