If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Combo Box
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 |
#2
|
|||
|
|||
Combo Box
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. -- Kind regards Noƫlla "Roger Bell" wrote: 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 |
#3
|
|||
|
|||
Combo Box
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 Roger Bell wrote: 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 |
Thread Tools | |
Display Modes | |
|
|