How to add a blank line in a combobox

  • Thread starter Thread starter mieke
  • Start date Start date
M

mieke

Hi,

I want to add a blank line to a combobox, but still limit the entries
possible.
The lines in the combobox come from a table.
 
Hi,

I want to add a blank line to a combobox, but still limit the entries
possible.
The lines in the combobox come from a table.

I believe you will have to load the combo box in the forms load
event. Unless you want to create a blank record in the table, then
you will have to change the rowsource type of the combo box to value
list, and create a list by looping through the records in the table,
one at a time.

dim db as database
dim rs as recordset
dim Done as boolean
dim strList as string

Done=false
strList=""
set db=currentdb( )
set rs=db.openrecordset("tblNames",dbopentable)
while not Done
strList=strList & "," & NZ(rs.fields("FirstName").value,"")
rs.movenext
if rs.eof then
Done=true
endif

wend

WARNING! This only works for a short list, not a cast of thousands.
 
Back
Top