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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|