Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set Listbox Default value

Status
Not open for further replies.

ColdPolarBear

IS-IT--Management
Jan 27, 2010
6
0
0
CA
I have set up a data entry form that uses numerous list boxes. These list boxes are linked to various LookUp tables. I am trying to get each list box to display a default value when you add a new record. When moving to create a new record, I want all the list boxes to appear empty, then user would would make a selection from the drop down list.

A sample table that contains the list items is: LKPCountry
ID Country
000
101 Australia
201 Bahamas
204 China

Properties for listbox include:
Bound Column: 2

Row Source:SELECT [LKPCountry].[ID], [LKPCountry].[country] FROM LKPCountry ORDER BY [ID];

Default Value: [List104].[ItemData](0)


Q:Whta do I need to corret to have the list box appear to be blank when creating a new record?

Thanks for your assistance
 
Duane,

I simply want the list box to display No value (appear blank or Null)as the default. Then the individual adding a new record is forced to review the list of items in the drop down list box and make a selection.

Thanks for your reply.
 
As the Country Field is the bound colum that populates the table, I want the List box to display in order of the ID fild in the LKPCountry table.

At the present time, say I add record #36 and select Australia as the country, when I create the next record it automatically displays Australia in the List box for the record. It is as if it is inheriting the value from the previous record. Still struggling to just have the list box for the next record display essentially as an empty list box or Is Null value as the default.

I have tried setting the the default value of the list box to IsNull and "" thinking that the bound column should be the column referenced when setting the default value.
Still no luck!
Thanks again for your time.
 
How are ya ColdPolarBear . . .
ColdPolarBear said:
[blue]What do I need to corret to have the list box appear to be blank when creating a new record?[/blue]
In the [blue]On Current[/blue] event of the form, copy/paste the following:
Code:
[blue]   If Me.NewRecord Then
      Me.[purple][B][I]YourListboxName[/I][/B][/purple] = Null
   End If[/blue]
[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see faq219-2884 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
If the list box is displaying the same value as the previous record when you move to a new one then it seems it doesn't have a control source. Either that or you have code that sets the default value based on the current value.

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top