Combo Box

R

Roger Bell

I have a Combo Box on a form that the user can use to Look up a Name.
What I would like is when a name EG: SMITH is selected and it turns out to
be the wrong SMITH, that by clicking on the Combo Box arrow, the cursor will
stay in the SMITH area instead of returning to the beginning of the list, the
A's.

This is the After Update Event Procedure for the combo box at present:

Private Sub Combo565_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[AUTONUMBER] = " & Str(Nz(Me![Combo565], 0))
If rs.EOF Then Else Me.Bookmark = rs.Bookmark
rs.Close
Me.Combo565 = Null
DoCmd.RunCommand acCmdSaveRecord
End Sub

Is there a way I can achieve this? and many thanks for any help
 
N

NG

Hi Roger,

maybe it's more rewarding to the users to show some more information in the
drop down area so the user can pick out the right Smith from the first time.
 
J

John Spencer

If you want the combobox to stay on the row selected, then don't set it to null.

Private Sub Combo565_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

If IsNull(Me.Combo565) then
'Do Nothing
ELSE
Set rs = Me.Recordset.Clone
rs.FindFirst "[AUTONUMBER] = " & Me![Combo565]
if rs.NoMatch = False then
Me.Bookmark = rs.Bookmark
rs.Close
Me.Combo565 = Null
DoCmd.RunCommand acCmdSaveRecord
End If
END IF

End Sub

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top