Here's a simple example of a RowSource for a combo box which does this:
SELECT AddressID, LastName,1 As SortColumn
FROM Addresses
UNION
SELECT NULL,"*",0 FROM Addresses
ORDER BY SortColumn, LastName;
The first column is hidden by setting the control's ColumnWidths property to
0cm;8cm. The ColumnCount is set to 2. How you use this depends on what you
want to happen when the user makes a selection, but here's some simple code
form the control's AfterUpdate event procedure which goes to the selected
addressee or requeries the form to go back to the first record if the user
selects *.
Private Sub cboFindName_AfterUpdate()
Dim rst As Object
Dim strCriteria As String
If Not IsNull(cboFindName) Then
strCriteria = "AddressID = " & cboFindName
Set rst = Me.Recordset.Clone
rst.FindFirst strCriteria
If Not rst.EOF Then
Me.Bookmark = rst.Bookmark
Else
MsgBox "Addressee not found"
End If
Else
Me.Requery
End If
End Sub
Ken Sheridan
Stafford, England