|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Access 2000 RecordSet - Search for Record and Edit it
I am using access 2000 and I want to be able to do this.
User comes up a form and enters a primary key then tabs off. Access finds that record and displays the information in the appropriate text boxes. The user can then edit the information and click complete. Currently when the user enters the primary key Access thinks that the user is trying to add another record with the same primary key. I am thinking the problem might be that the form is bound to that table, but when I unbind it the code does not work. Code is listed below. Thanks in advance for any help you can provide! CODE STARTS HERE Private Sub txtTagNumber_AfterUpdate() Dim strSearch As String On Error GoTo ErrorHandler strSearch = "[TagNumber] = " & Me![txtTagNumber] Me.Requery Me.RecordsetClone.FindFirst strSearch Me.Bookmark = Me.RecordsetClone.Bookmark ErrorHandlerExit: Exit Sub ErrorHandler: MsgBox "Error No: " & Err.Number & "; Description: " _ & Err.Description Resume ErrorHandlerExit End Sub |
|
#2
|
||||
|
||||
|
Public Sub FindMeth()
Dim db As Database Dim rec As DAO.Recordset Dim intPK As Integer Set db = CurrentDb() Set rec = CurrentDb.OpenRecordset("SELECT * FROM tblNames", dbOpenDynaset) intPK = 4 rec.FindFirst "PK = " & intPK Do While rec.NoMatch = False Debug.Print rec("Name") & " is a " & rec("Major") & " major" rec.FindNext "PK = " & intPK Loop End Sub |
|
#3
|
|||
|
|||
|
Thank you!
|
![]() |
| Viewing: Dev Shed Forums > Databases > Database Management > Access 2000 RecordSet - Search for Record and Edit it |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|