Key recognition

  • Thread starter Thread starter Leaf
  • Start date Start date
L

Leaf

Hello,

I would like to type in an ID in an ACCESS form and if
that ID exists in the table, I would like to have it bring
up or display the whole record on this same form. How
could I achieve that?

Thank you very much indeed.

Leaf
 
Put the following code in the AfterUpdate event of the textbox where you type in
ID. Code assumes the name of the textbox is ID, there's a field in your table
called ID and the ID field is numeric.

Dim Rst As DAO.Recordset
Set Rst = Me.RecordsetClone
Rst.FindFirst "[ID] = " & Me!ID
If Rst.NoMatch = False Then
Me.BookMark = Rst.BookMark
Else
MsgBox "Your ID Is Not In Datebase"
End If
Rst.Close


--
PC Datasheet
A Resource for Access, Excel and Word Applications
(e-mail address removed)
www.pcdatasheet.com

· Design and basic development for new applications
· Additions, Modifications and "Fixes" for existing applications
· Mentoring for do-it-yourselfers who want guidance
· Complete application design and development
· Applications Using Palm Pilot To Collect Data And
Synchronize The Data Back To Access Or Excel
 
Will be easy to modify the following codes for key
recognition if ID is text field such as MNCAM00001?
Many thanks!!
leaf
-----Original Message-----
Put the following code in the AfterUpdate event of the textbox where you type in
ID. Code assumes the name of the textbox is ID, there's a field in your table
called ID and the ID field is numeric.

Dim Rst As DAO.Recordset
Set Rst = Me.RecordsetClone
Rst.FindFirst "[ID] = " & Me!ID
If Rst.NoMatch = False Then
Me.BookMark = Rst.BookMark
Else
MsgBox "Your ID Is Not In Datebase"
End If
Rst.Close


--
PC Datasheet
A Resource for Access, Excel and Word Applications
(e-mail address removed)
www.pcdatasheet.com

· Design and basic development for new applications
· Additions, Modifications and "Fixes" for existing applications
· Mentoring for do-it-yourselfers who want guidance
· Complete application design and development
· Applications Using Palm Pilot To Collect Data And
Synchronize The Data Back To Access Or Excel

Leaf said:
Hello,

I would like to type in an ID in an ACCESS form and if
that ID exists in the table, I would like to have it bring
up or display the whole record on this same form. How
could I achieve that?

Thank you very much indeed.

Leaf


.
 
Back
Top