Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / April 2008

Tip: Looking for answers? Try searching our database.

Selecting a record by number

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rayo K - 18 Apr 2008 10:21 GMT
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
Klatuu - 18 Apr 2008 15:15 GMT
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
Signature

Dave Hargis, Microsoft Access MVP

> 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
Rayo K - 19 Apr 2008 09:01 GMT
> 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!
Klatuu - 21 Apr 2008 14:35 GMT
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.
Signature

Dave Hargis, Microsoft Access MVP

> > Requiring users to remember ID numbers?  Not good.
>
[quoted text clipped - 4 lines]
>
> Thank you!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.