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!

Adding a Blank Line to top of Combo Box List 1

Status
Not open for further replies.

nikkiswin

Technical User
May 22, 2002
7
0
0
GB
I have a combo box on a form which currently displays a list of values queried from a table.
I want the user to EITHER leave the field blank OR select from the list.
Unfortunately, once they have selected something from the list there is no way for them to set the field back to blank. I would like to add a blank line to the top of the drop down list so that this can be selected.
Any suggestions??
 
Create a record with a blank entry. Then set your combo's default value to the key (bound value). Then if a user selects a record and changes their mind, they can select the blank record or delete the entry. Either way the blank entry is selected.

:)
 
Thanks
it works but doesn't seem very elegant compared to what I would normally do in VB which is to use AddItem to add something to the combo box without affecting the database.
 
Hi,

I had a similar issue a few weeks ago and basically got the same suggestion: add a value to the table. In FoxPro, you can load a control from an array. There are functions that allow you to add values to an array, so it is very easy to add any value that you want to a control. You simply append the array and reload the control. I guess this is a limitation in Access. If you don't want to add a blank record to the table that has your "real" data ( I agree with you), you might create a new table that contains only one record with nothing in it, and load the combo box with a query that pulls data from the table that contains your data, and that one record from the table with the blank record.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top