A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Combo Box



 
 
Thread Tools Display Modes
  #1  
Old August 7th, 2009, 09:28 AM posted to microsoft.public.access.gettingstarted
Roger Bell
external usenet poster
 
Posts: 275
Default 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  
Old August 7th, 2009, 12:24 PM posted to microsoft.public.access.gettingstarted
NG[_2_]
external usenet poster
 
Posts: 59
Default 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  
Old August 7th, 2009, 02:19 PM posted to microsoft.public.access.gettingstarted
John Spencer
external usenet poster
 
Posts: 7,815
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:30 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.