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 » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Selecting a record by number



 
 
Thread Tools Display Modes
  #1  
Old April 18th, 2008, 10:21 AM posted to microsoft.public.access.forms
Rayo K
external usenet poster
 
Posts: 28
Default Selecting a record by number

Hello, I have a database with a recordset having a primary key. I want to add
a feature that allows the user to select the recrod ID from either a combo
box or by entering the number in a text box. I know this is possible but I
can't remember how. Please help! Thanks
  #2  
Old April 18th, 2008, 03:15 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default Selecting a record by number

Requiring users to remember ID numbers? Not good.

Is this ID an autonumber field and is it the primary key?

Assuming it is, I would suggest a text box. It is faster for a user to
enter a number than to select it from a text box. Here is the usual way to
make a selected record the current record. Use the After Update event of
the text box:

Private Sub txtID_AfterUPdate()

With Me.RecordsetClone
.FindFirst "[IDFieldName] = " & Me.txtID
If .NoMatch Then
MsgBox "Record " & Me.txtID & " Not Found", vbExclamation
Else
Me.Bookmark = .Bookmark
End If
End With
End Sub
--
Dave Hargis, Microsoft Access MVP


"Rayo K" wrote:

Hello, I have a database with a recordset having a primary key. I want to add
a feature that allows the user to select the recrod ID from either a combo
box or by entering the number in a text box. I know this is possible but I
can't remember how. Please help! Thanks

  #3  
Old April 19th, 2008, 09:01 AM posted to microsoft.public.access.forms
Rayo K
external usenet poster
 
Posts: 28
Default Selecting a record by number



"Klatuu" wrote:

Requiring users to remember ID numbers? Not good.


We refer to the records by their ID which is on the report. But if it is
better not to use the primary key for that, let me know.




Thanks for the solution, I will try it out.

Thank you!


  #4  
Old April 21st, 2008, 02:35 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default Selecting a record by number

If that is something the users are comfortable with, it is fine. Using
primary keys to find records is a very normal way to do this, but usually,
the user is actuall shown a unique piece of data that is "human" meaningful,
like a name or an SSN.

Not saying it is necessarily wrong, just unusual.
--
Dave Hargis, Microsoft Access MVP


"Rayo K" wrote:



"Klatuu" wrote:

Requiring users to remember ID numbers? Not good.


We refer to the records by their ID which is on the report. But if it is
better not to use the primary key for that, let me know.




Thanks for the solution, I will try it out.

Thank you!


 




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:29 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.